
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>五、Spring Boot Actuator: 生产就绪功能 · Spring Boot 中文文档</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="lichongbing.com">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism-twilight.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="production-ready.html" />
    
    
    <link rel="prev" href="spring-boot-features.html" />
    

    <style>
    @media only screen and (max-width: 640px) {
        .book-header .hidden-mobile {
            display: none;
        }
    }
    </style>
    <script>
        window["gitbook-plugin-github-buttons"] = {"repo":"lichongbing/springboot","types":["star","watch"],"size":"small"};
    </script>

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="boot-documentation.html">
            
                <a href="boot-documentation.html">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="boot-documentation.html">
            
                <a href="boot-documentation.html#boot-documentation">
            
                    
                    一、Spring Boot 文档
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="boot-documentation.html">
            
                <a href="boot-documentation.html#boot-documentation-about">
            
                    
                    1、关于本文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="boot-documentation.html">
            
                <a href="boot-documentation.html#boot-documentation-getting-help">
            
                    
                    2、获取帮助
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="boot-documentation.html">
            
                <a href="boot-documentation.html#boot-documentation-first-steps">
            
                    
                    3、起步
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="boot-documentation.html">
            
                <a href="boot-documentation.html#_working_with_spring_boot">
            
                    
                    4、使用 Spring Boot
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="boot-documentation.html">
            
                <a href="boot-documentation.html#_learning_about_spring_boot_features">
            
                    
                    5、了解 Spring Boot 的新特性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="boot-documentation.html">
            
                <a href="boot-documentation.html#_moving_to_production">
            
                    
                    6、生产环境
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="boot-documentation.html">
            
                <a href="boot-documentation.html#_advanced_topics">
            
                    
                    7、高级内容
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="getting-started.html">
            
                <a href="getting-started.html">
            
                    
                    二、入门
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-introducing-spring-boot">
            
                    
                    8、Spring Boot 简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-system-requirements">
            
                    
                    9、系统要求
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.2.1" data-path="getting-started.html">
            
                <a href="getting-started.html#_servlet_containers">
            
                    
                    9.1、Servlet 容器
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-installing-spring-boot">
            
                    
                    10、安装 Spring Boot
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.3.1" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-installation-instructions-for-java">
            
                    
                    10.1、针对 Java 开发人员的安装说明
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.3.1.1" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-maven-installation">
            
                    
                    10.1.1、Maven 安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3.1.2" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-gradle-installation">
            
                    
                    10.1.2、Gradle 安装
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.3.2" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-installing-the-cli">
            
                    
                    10.2、安装 Spring Boot CLI
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.3.2.1" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-manual-cli-installation">
            
                    
                    10.2.1、手动安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3.2.2" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-sdkman-cli-installation">
            
                    
                    10.2.2、使用 SDKMAN! 安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3.2.3" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-homebrew-cli-installation">
            
                    
                    10.2.3、使用 OSX Homebrew 安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3.2.4" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-macports-cli-installation">
            
                    
                    10.2.4、使用 MacPorts 安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3.2.5" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-cli-command-line-completion">
            
                    
                    10.2.5、命令行完成
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3.2.6" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-cli-example">
            
                    
                    10.2.6、快速入门 Spring CLI 示例
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.3.3" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-upgrading-from-an-earlier-version">
            
                    
                    10.3、升级旧版 Spring Boot
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-first-application">
            
                    
                    11、开发第一个 Spring Boot 应用
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.4.1" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-first-application-pom">
            
                    
                    11.1、 创建 POM
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.2" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-first-application-dependencies">
            
                    
                    11.2、 添加 Classpath 依赖
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.3" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-first-application-code">
            
                    
                    11.3、 编码
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.4.3.1" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-first-application-annotations">
            
                    
                    11.3.1、@RestController 与 @RequestMapping 注解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.3.2" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-first-application-auto-configuration">
            
                    
                    11.3.2、@EnableAutoConfiguration 注解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.3.3" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-first-application-main-method">
            
                    
                    11.3.3、main 方法
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.4.4" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-first-application-run">
            
                    
                    11.4、运行示例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.5" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-first-application-executable-jar">
            
                    
                    11.5、创建可执行 jar
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="getting-started.html">
            
                <a href="getting-started.html#getting-started-whats-next">
            
                    
                    12、下一步
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html">
            
                    
                    三、使用 Spring Boot
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-build-systems">
            
                    
                    13、构建系统
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1.1" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-dependency-management">
            
                    
                    13.1、依赖管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.2" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-maven">
            
                    
                    13.2、Maven
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1.2.1" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-maven-parent-pom">
            
                    
                    13.2.1、继承 Starter Parent
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1.2.1.1" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-maven-without-a-parent">
            
                    
                    13.2.2、不使用父 POM
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.2.1.2" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-maven-plugin">
            
                    
                    13.2.3、使用 Spring Boot Maven 插件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5.1.3" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-gradle">
            
                    
                    13.3、Gradle
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.4" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-ant">
            
                    
                    13.4、Ant
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.5" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-starter">
            
                    
                    13.5、Starter
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-structuring-your-code">
            
                    
                    14、组织代码
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.2.1" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-using-the-default-package">
            
                    
                    14.1、使用 default 包
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.2" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-locating-the-main-class">
            
                    
                    14.2、定位主应用类
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-configuration-classes">
            
                    
                    15、配置类
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.3.1" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-importing-configuration">
            
                    
                    15.1、导入额外的配置类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3.2" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-importing-xml-configuration">
            
                    
                    15.2、导入 XML 配置
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-auto-configuration">
            
                    
                    16、自动配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.4.1" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-replacing-auto-configuration">
            
                    
                    16.1、平滑替换自动配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4.2" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-disabling-specific-auto-configuration">
            
                    
                    16.2、禁用指定的自动配置类
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-spring-beans-and-dependency-injection">
            
                    
                    17、Spring Bean 与依赖注入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-using-springbootapplication-annotation">
            
                    
                    18、使用 @SpringBootApplication 注解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-running-your-application">
            
                    
                    19、运行您的应用
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.7.1" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-running-your-application">
            
                    
                    19.1、使用 IDE 运行
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7.2" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-running-as-a-packaged-application">
            
                    
                    19.2、作为打包应用运行
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7.3" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-running-with-the-maven-plugin">
            
                    
                    19.3、使用 Maven 插件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7.4" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-running-with-the-gradle-plugin">
            
                    
                    19.4、使用 Gradle 插件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7.5" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-hot-swapping">
            
                    
                    19.5、热交换
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-devtools">
            
                    
                    20、开发者工具
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.8.1" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-devtools-property-defaults">
            
                    
                    20.1、Property 默认值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8.2" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-devtools-restart">
            
                    
                    20.2、自动重启
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.8.2.1" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-devtools-restart-logging-condition-delta">
            
                    
                    20.2.1、条件评估变更日志
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8.2.2" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-devtools-restart-exclude">
            
                    
                    20.2.2、排除资源
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8.2.3" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-devtools-restart-additional-paths">
            
                    
                    20.2.3、监视附加路径
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8.2.4" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-devtools-restart-disable">
            
                    
                    20.2.4、禁用重启
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8.2.5" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-devtools-restart-triggerfile">
            
                    
                    20.2.5、使用触发文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8.2.6" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-devtools-customizing-classload">
            
                    
                    20.2.6、自定义重启类加载器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8.2.7" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-devtools-known-restart-limitations">
            
                    
                    20.2.7、已知限制
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5.8.3" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-devtools-livereload">
            
                    
                    20.3、LiveReload
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8.4" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-devtools-globalsettings">
            
                    
                    20.4、全局设置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8.5" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-devtools-remote">
            
                    
                    20.5、远程应用
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.8.5.1" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#_running_the_remote_client_application">
            
                    
                    20.5.1、运行远程客户端应用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8.5.2" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-devtools-remote-update">
            
                    
                    20.5.2、远程更新
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5.9" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-packaging-for-production">
            
                    
                    21、打包生产应用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.10" data-path="using-spring-boot.html">
            
                <a href="using-spring-boot.html#using-boot-whats-next">
            
                    
                    22、下一步
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features">
            
                    
                    四、Spring Boot 特性
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-spring-application">
            
                    
                    23、SpringApplication
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-startup-failure">
            
                    
                    23.1、启动失败
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.1.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-banner">
            
                    
                    23.2、自定义 banner
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.1.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-customizing-spring-application">
            
                    
                    23.3、自定义 SpringApplication
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.1.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-customizing-spring-application">
            
                    
                    23.4、Fluent Builder API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.1.5" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-application-events-and-listeners">
            
                    
                    23.5、应用程序事件与监听器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.1.6" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-web-environment">
            
                    
                    23.6、Web 环境
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.1.7" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-application-arguments">
            
                    
                    23.7、访问应用程序参数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.1.8" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-command-line-runner">
            
                    
                    23.8、使用 ApplicationRunner 或 ApplicationRunner
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.1.9" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-application-exit">
            
                    
                    23.9、应用程序退出
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.1.10" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-application-admin">
            
                    
                    23.10、管理功能
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-external-config">
            
                    
                    24、外部化配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.2.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-external-config-random-values">
            
                    
                    24.1、配置随机值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-external-config-command-line-args">
            
                    
                    24.2、访问命令行属性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-external-config-application-property-files">
            
                    
                    24.3、应用程序属性文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-external-config-profile-specific-properties">
            
                    
                    24.4、特定 Profile 的属性文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.5" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-external-config-placeholders-in-properties">
            
                    
                    24.5、属性中的占位符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.6" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-encrypting-properties">
            
                    
                    24.6、加密属性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.7" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-external-config-yaml">
            
                    
                    24.7、使用 YAML 代替属性文件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.2.7.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-external-config-loading-yaml">
            
                    
                    24.7.1、加载 YAML
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.7.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-external-config-exposing-yaml-to-spring">
            
                    
                    24.7.2、在 Spring Environment 中将 YAML 暴露为属性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.7.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-external-config-multi-profile-yaml">
            
                    
                    24.7.3、多 profile YAML 文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.7.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-external-config-yaml-shortcomings">
            
                    
                    24.7.4、YAML 的缺点
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.2.8" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-external-config-typesafe-configuration-properties">
            
                    
                    24.8、类型安全的配置属性
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.2.8.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-external-config-3rd-party-configuration">
            
                    
                    24.8.1、第三方配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.8.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-external-config-relaxed-binding">
            
                    
                    24.8.2、宽松绑定
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.8.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-external-config-complex-type-merge">
            
                    
                    24.8.3、合并复杂类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.8.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-external-config-conversion">
            
                    
                    24.8.4、属性转换
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.2.8.4.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-external-config-conversion-duration">
            
                    
                    转换 duration
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.8.4.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-external-config-conversion-datasize">
            
                    
                    转换 Data Size
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.2.8.5" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-external-config-validation">
            
                    
                    24.8.5、@ConfigurationProperties 验证
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.8.6" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-external-config-vs-value">
            
                    
                    24.8.6、@ConfigurationProperties 与 @Value 对比
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-profiles">
            
                    
                    25、Profile
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.3.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-adding-active-profiles">
            
                    
                    25.1、添加激活 Profile
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-programmatically-setting-profiles">
            
                    
                    25.2、以编程方式设置 Profile
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-profile-specific-configuration">
            
                    
                    25.3、特定 Profile 的配置文件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-logging">
            
                    
                    26、日志记录
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.4.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-logging-format">
            
                    
                    26.1、日志格式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-logging-console-output">
            
                    
                    26.2、控制台输出
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.4.2.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-logging-color-coded-output">
            
                    
                    26.2.1、着色输出
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.4.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-logging-file-output">
            
                    
                    26.3、文件输出
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-custom-log-levels">
            
                    
                    26.4、日志等级
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4.5" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-custom-log-groups">
            
                    
                    26.5、日志组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4.6" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-custom-log-configuration">
            
                    
                    26.6、自定义日志配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4.7" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-logback-extensions">
            
                    
                    26.7、Logback 扩展
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.4.7.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#_profile_specific_configuration">
            
                    
                    26.7.1、特定 Profile 配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4.7.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#_environment_properties">
            
                    
                    26.7.2、环境属性
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-json">
            
                    
                    27、JSON
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.5.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-json-jackson">
            
                    
                    27.1、Jackson
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-json-gson">
            
                    
                    27.2、Gson
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-json-json-b">
            
                    
                    27.3、JSON-B
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-developing-web-applications">
            
                    
                    28、开发 Web 应用程序
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.6.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-spring-mvc">
            
                    
                    28.1、Spring Web MVC 框架
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.6.1.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-spring-mvc-auto-configuration">
            
                    
                    28.1.1、Spring MVC 自动配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6.1.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-spring-mvc-message-converters">
            
                    
                    28.1.2、HttpMessageConverters
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6.1.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-spring-message-codes">
            
                    
                    28.1.3、自定义 JSON Serializer 和 Deserializer
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6.1.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-spring-mvc-static-content">
            
                    
                    28.1.5、静态内容
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6.1.5" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-spring-mvc-welcome-page">
            
                    
                    28.1.6、欢迎页面
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6.1.6" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-spring-mvc-favicon">
            
                    
                    28.1.7、自定义 Favicon
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6.1.7" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-spring-mvc-pathmatch">
            
                    
                    28.1.8、路径匹配与内容协商
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6.1.8" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-spring-mvc-web-binding-initializer">
            
                    
                    28.1.9、ConfigurableWebBindingInitializer
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6.1.9" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-spring-mvc-template-engines">
            
                    
                    28.1.10、模板引擎
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6.1.10" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-error-handling">
            
                    
                    28.1.11、错误处理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.6.1.10.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-error-handling-custom-error-pages">
            
                    
                    28.1.11.1、自定义错误页面
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6.1.10.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-error-handling-mapping-error-pages-without-mvc">
            
                    
                    28.1.11.2、映射到 Spring MVC 之外的错误页面
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.6.1.11" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-spring-hateoas">
            
                    
                    28.1.12、Spring HATEOAS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6.1.12" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-cors">
            
                    
                    28.1.13、CORS 支持
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.6.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-webflux">
            
                    
                    28.2、Spring WebFlux 框架
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.6.2.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-webflux-auto-configuration">
            
                    
                    28.2.1、Spring WebFlux 自动配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6.2.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-webflux-httpcodecs">
            
                    
                    28.2.2、使用 HttpMessageReader 和 HttpMessageWriter 作为 HTTP 编解码器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6.2.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-webflux-static-content">
            
                    
                    28.2.3、静态内容
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6.2.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-webflux-template-engines">
            
                    
                    28.2.4、模板引擎
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6.2.5" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-webflux-error-handling">
            
                    
                    28.2.5、错误处理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.6.2.5.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-webflux-error-handling-custom-error-pages">
            
                    
                    28.2.5.1、自定义错误页面
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.6.2.6" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-webflux-web-filters">
            
                    
                    28.2.6、Web 过滤器
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.6.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-jersey">
            
                    
                    28.3、JAX-RS 与 Jersey
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-embedded-container">
            
                    
                    28.4、内嵌 Servlet 容器支持
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.6.4.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-embedded-container-servlets-filters-listeners">
            
                    
                    28.4.1、Servlet、Filter 与 Listener
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6.4.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-embedded-container-context-initializer">
            
                    
                    28.4.2、Servlet 上下文初始化
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.6.4.2.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-embedded-container-servlets-filters-listeners-scanning">
            
                    
                    28.4.2.1、扫描 Servlet、Filter 和 Listener
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.6.4.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-embedded-container-application-context">
            
                    
                    28.4.3、ServletWebServerApplicationContext
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6.4.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-customizing-embedded-containers">
            
                    
                    28.4.4、自定义内嵌 Servlet 容器
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.6.4.4.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-programmatic-embedded-container-customization">
            
                    
                    28.4.4.1、以编程方式自定义
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6.4.4.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-customizing-configurableservletwebserverfactory-directly">
            
                    
                    28.4.4.2、直接自定义 ConfigurableServletWebServerFactory
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.6.4.5" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-jsp-limitations">
            
                    
                    28.4.5、JSP 局限
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.6.5" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-reactive-server">
            
                    
                    28.5、内嵌响应式服务器支持
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6.6" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-reactive-server-resources">
            
                    
                    28.6、响应式服务器资源配置
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-security">
            
                    
                    29、安全
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.7.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-security-mvc">
            
                    
                    29.1、MVC 安全
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-security-webflux">
            
                    
                    29.2、WebFlux 安全
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-security-oauth2">
            
                    
                    29.3、OAuth2
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.7.3.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-security-oauth2-client">
            
                    
                    29.3.1、客户端
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.7.3.1.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-security-oauth2-common-providers">
            
                    
                    OAuth2 客户端注册常见的提供者
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.7.3.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-security-oauth2-server">
            
                    
                    29.3.2、资源服务器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7.3.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#_authorization_server">
            
                    
                    29.3.3、授权服务器
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.7.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-security-actuator">
            
                    
                    29.4、Actuator 安全
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.7.4.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-security-csrf">
            
                    
                    29.4.1、跨站请求伪造保护
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-sql">
            
                    
                    30、使用 SQL 数据库
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.8.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-configure-datasource">
            
                    
                    30.1、配置数据源
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.8.1.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-embedded-database-support">
            
                    
                    30.1.1、内嵌数据库支持
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8.1.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-connect-to-production-database">
            
                    
                    30.1.2、连接生产数据库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8.1.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-connecting-to-a-jndi-datasource">
            
                    
                    30.1.3、连接 JNDI 数据源
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.8.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-using-jdbc-template">
            
                    
                    30.2、使用 JdbcTemplate
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-jpa-and-spring-data">
            
                    
                    30.3、JPA 与 Spring Data JPA
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.8.3.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-jpa-and-spring-data">
            
                    
                    30.3.1、实体类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8.3.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-spring-data-jpa-repositories">
            
                    
                    30.3.2、Spring Data JPA 资源库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8.3.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-creating-and-dropping-jpa-databases">
            
                    
                    30.3.3、创建和删除 JPA 数据库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8.3.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-jpa-in-web-environment">
            
                    
                    30.3.4、在视图中打开 EntityManager
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.8.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-data-jdbc">
            
                    
                    30.4、Spring Data JDBC
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8.5" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-sql-h2-console">
            
                    
                    30.5、使用 H2 的 Web 控制台
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.8.5.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-sql-h2-console-custom-path">
            
                    
                    30.5.1、更改 H2 控制台的路径
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.8.6" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-jooq">
            
                    
                    30.6、使用 jOOQ
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.8.6.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#_code_generation">
            
                    
                    30.6.1、代码生成
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8.6.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#_using_dslcontext">
            
                    
                    30.6.2、使用 DSLContext
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8.6.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#_jooq_sql_dialect">
            
                    
                    30.6.3、jOOQ SQL 方言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8.6.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#_customizing_jooq">
            
                    
                    30.6.4、自定义 jOOQ
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-nosql">
            
                    
                    31、使用 NoSQL 技术
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.9.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-redis">
            
                    
                    31.1、Redis
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.9.1.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-connecting-to-redis">
            
                    
                    31.1.1、连接 Redis
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.9.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-mongodb">
            
                    
                    31.2、MongoDB
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.9.2.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-connecting-to-mongodb">
            
                    
                    31.2.1、连接 MongoDB 数据库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9.2.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-mongo-template">
            
                    
                    31.2.2、MongoTemplate
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9.2.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-spring-data-mongo-repositories">
            
                    
                    31.2.3、Spring Data MongoDB 资源库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9.2.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-mongo-embedded">
            
                    
                    31.2.4、内嵌 Mongo
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.9.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-neo4j">
            
                    
                    31.3、Neo4j
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.9.3.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-connecting-to-neo4j">
            
                    
                    31.3.1、连接 Neo4j 数据库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9.3.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-connecting-to-neo4j-embedded">
            
                    
                    31.3.2、使用内嵌模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9.3.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-neo4j-ogm-session">
            
                    
                    31.3.3、Neo4jSession
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9.3.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-spring-data-neo4j-repositories">
            
                    
                    31.3.4、Spring Data Neo4j 资源库
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.9.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-gemfire">
            
                    
                    31.4、Gemfire
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9.5" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-solr">
            
                    
                    31.5、Solr
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.9.5.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-solr">
            
                    
                    31.5.1、连接 Solr
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9.5.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-spring-data-solr-repositories">
            
                    
                    31.5.2、Spring Data Solr 资源库
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.9.6" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-elasticsearch">
            
                    
                    31.6、Elasticsearch
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.9.6.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-connecting-to-elasticsearch-rest">
            
                    
                    31.6.1、使用 REST 客户端连接 Elasticsearch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9.6.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-connecting-to-elasticsearch-jest">
            
                    
                    31.6.2、使用 Jest 连接 Elasticsearch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9.6.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-connecting-to-elasticsearch-spring-data">
            
                    
                    31.6.3、使用 Spring Data 连接 Elasticsearch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9.6.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-spring-data-elasticsearch-repositories">
            
                    
                    31.6.4、Spring Data Elasticsearch 资源库
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.9.7" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-cassandra">
            
                    
                    31.7、Cassandra
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.9.7.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-connecting-to-cassandra">
            
                    
                    31.7.1、连接 Cassandra
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9.7.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-spring-data-cassandra-repositories">
            
                    
                    31.7.2、Spring Data Cassandra 资源库
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.9.8" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-couchbase">
            
                    
                    31.8、Couchbase
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.9.8.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-connecting-to-couchbase">
            
                    
                    31.8.1、连接 Couchbase
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9.8.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-spring-data-couchbase-repositories">
            
                    
                    31.8.2、Spring Data Couchbase 资源库
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.9.9" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-ldap">
            
                    
                    31.9、LDAP
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.9.9.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-ldap-connecting">
            
                    
                    31.9.1、连接 LDAP 服务器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9.9.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-ldap-spring-data-repositories">
            
                    
                    31.9.2、Spring Data LDAP 资源库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9.9.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-ldap-embedded">
            
                    
                    31.9.3、内嵌内存式 LDAP 服务器
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.9.10" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-influxdb">
            
                    
                    31.10、InfluxDB
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.9.10.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-connecting-to-influxdb">
            
                    
                    31.10.1、连接 InfluxDB
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.10" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-caching">
            
                    
                    32、缓存
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.10.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-caching-provider">
            
                    
                    32.1、支持的缓存提供者
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.10.1.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-caching-provider-generic">
            
                    
                    32.1.1、Generic
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.10.1.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-caching-provider-jcache">
            
                    
                    32.1.2、JCache (JSR-107)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.10.1.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-caching-provider-ehcache2">
            
                    
                    32.1.3、EhCache 2.x
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.10.1.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-caching-provider-hazelcast">
            
                    
                    32.1.4、Hazelcast
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.10.1.5" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-caching-provider-infinispan">
            
                    
                    32.1.5、Infinispan
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.10.1.6" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-caching-provider-couchbase">
            
                    
                    32.1.6、Couchbase
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.10.1.7" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-caching-provider-redis">
            
                    
                    32.1.7、Redis
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.10.1.8" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-caching-provider-caffeine">
            
                    
                    32.1.8、Caffeine
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.10.1.9" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-caching-provider-simple">
            
                    
                    32.1.9、Simple
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.10.1.10" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-caching-provider-none">
            
                    
                    32.1.10、None
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.11" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-messaging">
            
                    
                    33、消息传递
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.11.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-jms">
            
                    
                    33.1、JMS
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.11.1.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-activemq">
            
                    
                    33.1.1、ActiveMQ 支持
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.11.1.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-artemis">
            
                    
                    33.1.2、Artemis 支持
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.11.1.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-jms-jndi">
            
                    
                    33.1.3、使用 JNDI ConnectionFactory
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.11.1.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-using-jms-sending">
            
                    
                    33.1.4、发送消息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.11.1.5" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-using-jms-receiving">
            
                    
                    33.1.5、接收消息
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.11.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-amqp">
            
                    
                    33.2、AMQP
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.11.2.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-rabbitmq">
            
                    
                    33.2.1、RabbitMQ 支持
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.11.2.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-using-amqp-sending">
            
                    
                    33.2.2、发送消息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.11.2.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-using-amqp-receiving">
            
                    
                    33.2.3、接收消息
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.11.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-kafka">
            
                    
                    33.3、Apache Kafka 支持
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.11.3.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-kafka-sending-a-message">
            
                    
                    33.3.1、发送消息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.11.3.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-kafka-receiving-a-message">
            
                    
                    33.3.2、接收消息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.11.3.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-kafka-streams">
            
                    
                    33.3.3、Kafka Stream
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.11.3.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-kafka-extra-props">
            
                    
                    33.3.4、其他 Kafka 属性
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.12" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-resttemplate">
            
                    
                    34、使用 RestTemplate 调用 REST 服务
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.12.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-resttemplate-customization">
            
                    
                    34.1、自定义 RestTemplate
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.12.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-resttemplate">
            
                    
                    34、使用 RestTemplate 调用 REST 服务
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.13" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-webclient">
            
                    
                    35、使用 WebClient 调用 REST 服务
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.13.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-webclient-runtime">
            
                    
                    35.1、WebClient 运行时
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.13.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-webclient-customization">
            
                    
                    35.2、自定义 WebClient
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.14" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-validation">
            
                    
                    36、验证
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.15" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-email">
            
                    
                    37、发送邮件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.16" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-jta">
            
                    
                    38、JTA 分布式事务
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.16.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-jta-atomikos">
            
                    
                    38.1、使用 Atomikos 事务管理器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.16.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-jta-bitronix">
            
                    
                    38.2、使用 Bitronix 事务管理器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.16.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-jta-javaee">
            
                    
                    38.3、使用 Java EE 管理的事务管理器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.16.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-jta-mixed-jms">
            
                    
                    38.4、混合使用 XA 与非 XA JMS 连接
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.17" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-hazelcast">
            
                    
                    39、Hazelcast
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.18" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-quartz">
            
                    
                    40、Quartz 调度器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.19" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-task-execution-scheduling">
            
                    
                    41、任务执行与调度
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.20" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-integration">
            
                    
                    42、Spring Integration
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.21" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-session">
            
                    
                    43、Spring Session
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.22" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-jmx">
            
                    
                    44、通过 JMX 监控和管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.23" >
            
                <span>
            
                    
                    45、测试
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.24" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-websockets">
            
                    
                    46、WebSocket
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.25" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-webservices">
            
                    
                    47、Web Service
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.25.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-webservices-template">
            
                    
                    47.1、使用 WebServiceTemplate 调用 Web Service
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.26" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-developing-auto-configuration">
            
                    
                    49、创建自己的自动配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.26.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-understanding-auto-configured-beans">
            
                    
                    49.1、理解自定配置 Bean
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.26.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-locating-auto-configuration-candidates">
            
                    
                    49.2、找到候选的自动配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.26.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-condition-annotations">
            
                    
                    49.3、条件注解
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.26.3.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-class-conditions">
            
                    
                    49.3.1、类条件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.26.3.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-bean-conditions">
            
                    
                    49.3.2、Bean 条件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.26.3.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-property-conditions">
            
                    
                    49.3.3、属性条件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.26.3.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-resource-conditions">
            
                    
                    49.3.4、资源条件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.26.3.5" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-web-application-conditions">
            
                    
                    49.3.5、Web 应用程序条件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.26.3.6" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-spel-conditions">
            
                    
                    49.3.6、SpEL 表达式条件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.26.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-test-autoconfig">
            
                    
                    49.4、测试自动配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.26.4.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#_simulating_a_web_context">
            
                    
                    49.4.1、模拟一个 Web 上下文
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.26.4.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#_overriding_the_classpath">
            
                    
                    49.4.2、覆盖 Classpath
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.26.5" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-custom-starter">
            
                    
                    49.5、创建自己的 Starter
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.26.5.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-custom-starter-naming">
            
                    
                    49.5.1、命名
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.26.5.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-custom-starter-module-autoconfigure">
            
                    
                    49.5.2、autoconfigure 模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.26.5.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-custom-starter-module-starter">
            
                    
                    49.5.3、Starter 模块
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.27" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-kotlin">
            
                    
                    50、Kotlin 支持
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.27.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-kotlin-requirements">
            
                    
                    50.1、要求
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.27.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-kotlin-null-safety">
            
                    
                    50.2、Null 安全
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.27.3" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-kotlin-api">
            
                    
                    50.3、Kotlin API
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.27.3.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-kotlin-api-runapplication">
            
                    
                    50.3.1、runApplication
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.27.3.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-kotlin-api-extensions">
            
                    
                    50.3.2、扩展
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.27.4" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-kotlin-dependency-management">
            
                    
                    50.4、依赖管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.27.5" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-kotlin-configuration-properties">
            
                    
                    50.5、@ConfigurationProperties
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.27.6" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-kotlin-testing">
            
                    
                    50.6、测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.27.7" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-kotlin-resources">
            
                    
                    50.7、资源
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.27.7.1" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-kotlin-resources-further-reading">
            
                    
                    50.7.1、进阶阅读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.27.7.2" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-kotlin-resources-examples">
            
                    
                    50.7.2、示例
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.28" data-path="spring-boot-features.html">
            
                <a href="spring-boot-features.html#boot-features-whats-next">
            
                    
                    51、下一步
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready">
            
                    
                    五、Spring Boot Actuator: 生产就绪功能
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-enabling">
            
                    
                    52、启用生产就绪功能
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-endpoints">
            
                    
                    53、端点
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.2.1" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-endpoints-enabling-endpoints">
            
                    
                    53.1、启用端点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.2" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-endpoints-exposing-endpoints">
            
                    
                    53.2、暴露端点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.3" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-endpoints-security">
            
                    
                    53.3、保护 HTTP 端点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.4" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-endpoints-caching">
            
                    
                    53.4、配置端点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.5" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-endpoints-hypermedia">
            
                    
                    53.5、Actuator Web 端点超媒体
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.6" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-endpoints-cors">
            
                    
                    53.6、跨域支持
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.7" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-endpoints-custom">
            
                    
                    53.7、实现自定义端点
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.2.7.1" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-endpoints-custom-input">
            
                    
                    53.7.1、接收输入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.7.2" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-endpoints-custom-web">
            
                    
                    53.7.2、自定义 Web 端点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.7.3" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-endpoints-custom-servlet">
            
                    
                    53.7.3、Servlet 端点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.7.4" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-endpoints-custom-controller">
            
                    
                    53.7.4、控制器端点
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.2.8" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-endpoints-custom-controller">
            
                    
                    53.8、健康信息
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.2.8.1" data-path="production-ready.html">
            
                <a href="production-ready.html#_auto_configured_healthindicators">
            
                    
                    53.8.1、自动配置的 HealthIndicator
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.8.2" data-path="production-ready.html">
            
                <a href="production-ready.html#_writing_custom_healthindicators">
            
                    
                    53.8.2、编写自定义 HealthIndicator
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.8.3" data-path="production-ready.html">
            
                <a href="production-ready.html#reactive-health-indicators">
            
                    
                    53.8.3、响应式健康指示器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.8.4" data-path="production-ready.html">
            
                <a href="production-ready.html#_auto_configured_reactivehealthindicators">
            
                    
                    53.8.4、自动配置的 ReactiveHealthIndicator
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.2.9" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-application-info">
            
                    
                    53.9、应用程序信息
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.2.9.1" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-application-info">
            
                    
                    53.9.1、自动配置的 InfoContributor
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.9.2" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-application-info-env">
            
                    
                    53.9.2、自定义应用程序信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.9.3" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-application-info-git">
            
                    
                    53.9.3、Git 提交信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.9.4" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-application-info-build">
            
                    
                    53.9.4、构建信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.9.5" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-application-info-build">
            
                    
                    53.9.5、编写自定义 InfoContributor
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-monitoring">
            
                    
                    54、通过 HTTP 监控和管理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.3.1" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-customizing-management-server-context-path">
            
                    
                    54.1、自定义 Management 端点路径
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.2" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-customizing-management-server-port">
            
                    
                    54.2、自定义 Management 服务器端口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.3" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-management-specific-ssl">
            
                    
                    54.3、配置 Management 的 SSL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.4" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-customizing-management-server-address">
            
                    
                    54.4、配置 Management 服务器地址
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.5" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-disabling-http-endpoints">
            
                    
                    54.5、禁用 HTTP 端点
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-jmx">
            
                    
                    55、通过 JMX 监控和管理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.4.1" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-custom-mbean-names">
            
                    
                    55.1、自定义 MBean 名称
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4.2" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-disable-jmx-endpoints">
            
                    
                    55.2、禁用 JMX 端点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4.3" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-jolokia">
            
                    
                    55.3、通过 HTTP 使用 Jolokia 访问 JMX
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.4.3.1" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-customizing-jolokia">
            
                    
                    55.3.1、自定义 Jolokia
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4.3.2" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-disabling-jolokia">
            
                    
                    55.3.2、禁用 Jolokia
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-loggers">
            
                    
                    56、日志记录器
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.5.1" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-logger-configuration">
            
                    
                    56.1、配置一个日志记录器
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics">
            
                    
                    57、指标
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.6.1" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-getting-started">
            
                    
                    57.1、入门
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.2" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-export">
            
                    
                    57.2、支持的监控系统
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.6.2.1" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-export-appoptics">
            
                    
                    57.2.1、AppOptics
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.2.2" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-export-atlas">
            
                    
                    57.2.2、Atlas
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.2.3" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-export-datadog">
            
                    
                    57.2.3、Datadog
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.2.4" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-export-dynatrace">
            
                    
                    57.2.4、Dynatrace
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.2.5" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-export-elastic">
            
                    
                    57.2.5、Elastic
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.2.6" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-export-ganglia">
            
                    
                    57.2.6、Ganglia
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.2.7" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-export-graphite">
            
                    
                    57.2.7、Graphite
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.2.8" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-export-humio">
            
                    
                    57.2.8、Humio
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.2.9" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-export-influx">
            
                    
                    57.2.9、Influx
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.2.10" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-export-jmx">
            
                    
                    57.2.10、JMX
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.2.11" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-export-kairos">
            
                    
                    57.2.11、KairosDB
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.2.12" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-export-newrelic">
            
                    
                    57.2.12、New Relic
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.2.13" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-export-prometheus">
            
                    
                    57.2.13、Prometheus
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.2.14" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-export-signalfx">
            
                    
                    57.2.14、SignalFx
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.2.15" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-export-simple">
            
                    
                    57.2.15、Simple
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.2.16" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-export-statsd">
            
                    
                    57.2.16、StatsD
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.2.17" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-export-wavefront">
            
                    
                    57.2.17、Wavefront
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.6.3" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-meter">
            
                    
                    57.3、支持的指标
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.6.3.1" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-spring-mvc">
            
                    
                    57.3.1、Spring MVC 指标
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.3.2" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-web-flux">
            
                    
                    57.3.2、Spring WebFlux 指标
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.3.3" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-jersey-server">
            
                    
                    57.3.3、Jersey Server 指标
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.3.4" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-http-clients">
            
                    
                    57.3.4、HTTP Client 指标
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.3.5" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-cache">
            
                    
                    57.3.5、Cache 指标
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.3.6" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-jdbc">
            
                    
                    57.3.6、数据源指标
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.3.7" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-hibernate">
            
                    
                    57.3.7、Hibernate 指标
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.3.8" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-rabbitmq">
            
                    
                    57.3.8、RabbitMQ 指标
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.6.4" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-custom">
            
                    
                    57.4、注册自定义指标
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.5" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-per-meter-properties">
            
                    
                    57.5、自定义单独指标
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.6.5.1" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-common-tags">
            
                    
                    57.5.1、自定义标签
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.5.2" data-path="production-ready.html">
            
                <a href="production-ready.html#_per_meter_properties">
            
                    
                    57.5.2、Per-meter 属性
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.6.6" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-metrics-endpoint">
            
                    
                    57.6、指标端点
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-auditing">
            
                    
                    58、审计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.8" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-http-tracing">
            
                    
                    59、HTTP 追踪
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.8.1" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-http-tracing-custom">
            
                    
                    59.1、自定义 HTTP 追踪
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.9" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-process-monitoring">
            
                    
                    60、进程监控
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.9.1" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-process-monitoring-configuration">
            
                    
                    60.1、扩展配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.9.2" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-process-monitoring-configuration">
            
                    
                    60.2、编程方式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.10" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-cloudfoundry">
            
                    
                    61、Cloud Foundry 支持
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.10.1" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-cloudfoundry-disable">
            
                    
                    61.1、禁用 Cloud Foundry Actuator 扩展支持
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.10.2" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-cloudfoundry-ssl">
            
                    
                    61.2、Cloud Foundry 自签名证书
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.10.3" data-path="production-ready.html">
            
                <a href="production-ready.html#_custom_context_path">
            
                    
                    61.3、自定义上下文路径
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.11" data-path="production-ready.html">
            
                <a href="production-ready.html#production-ready-auditing">
            
                    
                    62、下一步
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="deployment.html">
            
                <a href="deployment.html">
            
                    
                    六、部署 Spring Boot 应用程序
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" >
            
                <span>
            
                    
                    63、部署到云端
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" >
            
                <span>
            
                    
                    64、安装 Spring Boot 应用程序
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" >
            
                <span>
            
                    
                    65、下一步
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" >
            
                <span>
            
                    
                    七、Spring Boot CLI
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" >
            
                <span>
            
                    
                    66、安装 CLI
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" >
            
                <span>
            
                    
                    67、使用 CLI
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" >
            
                <span>
            
                    
                    68、使用 Groovy Beans DSL 部署应用程序
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" >
            
                <span>
            
                    
                    69、使用  配置 CLI
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.5" >
            
                <span>
            
                    
                    70、下一步
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" >
            
                <span>
            
                    
                    八、构建工具插件
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" >
            
                <span>
            
                    
                    71、Spring Boot Maven 插件
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" >
            
                <span>
            
                    
                    72、Spring Boot Gradle 插件
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" >
            
                <span>
            
                    
                    73、Spring Boot AntLib 模块
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" >
            
                <span>
            
                    
                    74、支持其他构建系统
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.5" >
            
                <span>
            
                    
                    75、下一步
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >五、Spring Boot Actuator: 生产就绪功能</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <p><a id="production-ready"></a></p>
<h1 id="&#x4E94;&#x3001;spring-boot-actuator-&#x751F;&#x4EA7;&#x5C31;&#x7EEA;&#x529F;&#x80FD;">&#x4E94;&#x3001;Spring Boot Actuator: &#x751F;&#x4EA7;&#x5C31;&#x7EEA;&#x529F;&#x80FD;</h1>
<p>Spring Boot &#x5305;&#x542B;&#x8BB8;&#x591A;&#x5176;&#x4ED6;&#x529F;&#x80FD;&#xFF0C;&#x53EF;&#x5E2E;&#x52A9;&#x4F60;&#x5728;&#x5C06;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x63A8;&#x9001;&#x5230;&#x751F;&#x4EA7;&#x73AF;&#x5883;&#x65F6;&#x76D1;&#x63A7;&#x548C;&#x7BA1;&#x7406;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x3002;&#x4F60;&#x53EF;&#x4EE5;&#x9009;&#x62E9;&#x4F7F;&#x7528; HTTP &#x7AEF;&#x70B9;&#x6216; JMX &#x6765;&#x7BA1;&#x7406;&#x548C;&#x76D1;&#x63A7;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x3002;&#x5BA1;&#x8BA1;&#x3001;&#x5065;&#x5EB7;&#x548C;&#x6307;&#x6807;&#x6536;&#x96C6;&#x4E5F;&#x53EF;&#x4EE5;&#x81EA;&#x52A8;&#x5E94;&#x7528;&#x4E8E;&#x4F60;&#x7684;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x3002;</p>
<p><a id="production-ready-enabling"></a></p>
<h2 id="52&#x3001;&#x542F;&#x7528;&#x751F;&#x4EA7;&#x5C31;&#x7EEA;&#x529F;&#x80FD;">52&#x3001;&#x542F;&#x7528;&#x751F;&#x4EA7;&#x5C31;&#x7EEA;&#x529F;&#x80FD;</h2>
<p><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator" target="_blank"><code>spring-boot-actuator</code></a> &#x6A21;&#x5757;&#x63D0;&#x4F9B;&#x4E86; Spring Boot &#x7684;&#x6240;&#x6709;&#x751F;&#x4EA7;&#x5C31;&#x7EEA;&#x529F;&#x80FD;&#x3002;&#x542F;&#x7528;&#x8FD9;&#x4E9B;&#x529F;&#x80FD;&#x7684;&#x6700;&#x7B80;&#x5355;&#x65B9;&#x6CD5;&#x662F;&#x6DFB;&#x52A0; <code>spring-boot-starter-actuator</code> starter &#x5230;&#x4F9D;&#x8D56;&#x4E2D;&#x3002;</p>
<blockquote>

**Actuator &#x7684;&#x5B9A;&#x4E49;**

Actuator &#x662F;&#x5236;&#x9020;&#x672F;&#x8BED;&#xFF0C;&#x6307;&#x7684;&#x662F;&#x7528;&#x4E8E;&#x79FB;&#x52A8;&#x6216;&#x63A7;&#x5236;&#x67D0;&#x7269;&#x7684;&#x673A;&#x68B0;&#x88C5;&#x7F6E;&#x3002;Actuator &#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x4E00;&#x4E2A;&#x5C0F;&#x7684;&#x53D8;&#x5316;&#x4EA7;&#x751F;&#x5927;&#x91CF;&#x7684;&#x8FD0;&#x52A8;&#x3002;

</blockquote>

<p>&#x8981;&#x5C06; actuator &#x6DFB;&#x52A0;&#x5230;&#x57FA;&#x4E8E; Maven &#x7684;&#x9879;&#x76EE;&#xFF0C;&#x8BF7;&#x6DFB;&#x52A0;&#x4EE5;&#x4E0B; starter &#x4F9D;&#x8D56;&#x9879;&#xFF1A;</p>
<pre class="language-"><code class="lang-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dependencies</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dependency</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>groupId</span><span class="token punctuation">&gt;</span></span>org.springframework.boot<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>groupId</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>artifactId</span><span class="token punctuation">&gt;</span></span>spring-boot-starter-actuator<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>artifactId</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dependency</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dependencies</span><span class="token punctuation">&gt;</span></span>
</code></pre>
<p>&#x5BF9;&#x4E8E; Gradle&#xFF0C;&#x8BF7;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x58F0;&#x660E;&#xFF1A;</p>
<pre class="language-"><code class="lang-groovy">dependencies <span class="token punctuation">{</span>
    <span class="token function">compile</span><span class="token punctuation">(</span><span class="token string">&quot;org.springframework.boot:spring-boot-starter-actuator&quot;</span><span class="token punctuation">)</span>
<span class="token punctuation">}</span>
</code></pre>
<p><a id="production-ready-endpoints"></a></p>
<h2 id="53&#x3001;&#x7AEF;&#x70B9;">53&#x3001;&#x7AEF;&#x70B9;</h2>
<p>&#x901A;&#x8FC7; Actuator &#x7AEF;&#x70B9;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x76D1;&#x63A7;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x5E76;&#x4E0E;&#x4E4B;&#x4EA4;&#x4E92;&#x3002;Spring Boot &#x5305;&#x542B;&#x8BB8;&#x591A;&#x5185;&#x7F6E;&#x7AEF;&#x70B9;&#xFF0C;&#x4E5F;&#x5141;&#x8BB8;&#x4F60;&#x6DFB;&#x52A0;&#x81EA;&#x5DF1;&#x7684;&#x7AEF;&#x70B9;&#x3002;&#x4F8B;&#x5982;&#xFF0C;<code>health</code> &#x7AEF;&#x70B9;&#x63D0;&#x4F9B;&#x57FA;&#x672C;&#x7684;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x5065;&#x5EB7;&#x4FE1;&#x606F;&#x3002;</p>
<p>&#x53EF;&#x4EE5;<a href="#production-ready-endpoints-enabling-endpoints">&#x542F;&#x7528;&#x6216;&#x7981;&#x7528;</a>&#x6BCF;&#x4E2A;&#x7AEF;&#x70B9;&#x3002;&#x5B83;&#x53EF;&#x63A7;&#x5236;&#x5F53;&#x5176; bean &#x5B58;&#x5728;&#x4E8E;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4E0A;&#x4E0B;&#x6587;&#x4E2D;&#x662F;&#x5426;&#x521B;&#x5EFA;&#x7AEF;&#x70B9;&#x3002;&#x8981;&#x8FDB;&#x884C;&#x8FDC;&#x7A0B;&#x8BBF;&#x95EE;&#xFF0C;&#x5FC5;&#x987B;<a href="#production-ready-endpoints-exposing-endpoints">&#x901A;&#x8FC7; JMX &#x6216; HTTP &#x66B4;&#x9732;&#x7AEF;&#x70B9;</a>&#x3002;&#x5927;&#x591A;&#x6570;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x9009;&#x62E9; HTTP &#x65B9;&#x5F0F;&#xFF0C;&#x7AEF;&#x70B9;&#x7684; ID &#x4EE5;&#x53CA; <code>/actuator</code> &#x7684;&#x524D;&#x7F00;&#x6620;&#x5C04;&#x5230;&#x4E00;&#x4E2A; URL&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;<code>health</code> &#x7AEF;&#x70B9;&#x6620;&#x5C04;&#x5230; <code>/actuator/health</code>&#x3002;</p>
<p>&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x4E0E;&#x6280;&#x672F;&#x65E0;&#x5173;&#x7684;&#x7AEF;&#x70B9;&#xFF1A;</p>
<table>
<thead>
<tr>
<th>ID</th>
<th>&#x63CF;&#x8FF0;</th>
<th style="text-align:center">&#x9ED8;&#x8BA4;&#x542F;&#x7528;</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>auditevents</code></td>
<td>&#x66B4;&#x9732;&#x5F53;&#x524D;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x7684;&#x5BA1;&#x8BA1;&#x4E8B;&#x4EF6;&#x4FE1;&#x606F;&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>beans</code></td>
<td>&#x663E;&#x793A;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4E2D;&#x6240;&#x6709; Spring bean &#x7684;&#x5B8C;&#x6574;&#x5217;&#x8868;&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>caches</code></td>
<td>&#x66B4;&#x9732;&#x53EF;&#x7528;&#x7684;&#x7F13;&#x5B58;&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>conditions</code></td>
<td>&#x663E;&#x793A;&#x5728;&#x914D;&#x7F6E;&#x548C;&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x7C7B;&#x4E0A;&#x8BC4;&#x4F30;&#x7684;&#x6761;&#x4EF6;&#x4EE5;&#x53CA;&#x5B83;&#x4EEC;&#x5339;&#x914D;&#x6216;&#x4E0D;&#x5339;&#x914D;&#x7684;&#x539F;&#x56E0;&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>configprops</code></td>
<td>&#x663E;&#x793A;&#x6240;&#x6709; <code>@ConfigurationProperties</code> &#x7684;&#x6821;&#x5BF9;&#x6E05;&#x5355;&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>env</code></td>
<td>&#x66B4;&#x9732; Spring <code>ConfigurableEnvironment</code> &#x4E2D;&#x7684;&#x5C5E;&#x6027;&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>flyway</code></td>
<td>&#x663E;&#x793A;&#x5DF2;&#x5E94;&#x7528;&#x7684; Flyway &#x6570;&#x636E;&#x5E93;&#x8FC1;&#x79FB;&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>health</code></td>
<td>&#x663E;&#x793A;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x5065;&#x5EB7;&#x4FE1;&#x606F;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>httptrace</code></td>
<td>&#x663E;&#x793A; HTTP &#x8FFD;&#x8E2A;&#x4FE1;&#x606F;&#xFF08;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x6700;&#x540E; 100 &#x4E2A; HTTP &#x8BF7;&#x6C42;/&#x54CD;&#x5E94;&#x4EA4;&#x6362;&#xFF09;&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>info</code></td>
<td>&#x663E;&#x793A;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4FE1;&#x606F;&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>integrationgraph</code></td>
<td>&#x663E;&#x793A; Spring Integration &#x56FE;&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>loggers</code></td>
<td>&#x663E;&#x793A;&#x548C;&#x4FEE;&#x6539;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4E2D;&#x65E5;&#x5FD7;&#x8BB0;&#x5F55;&#x5668;&#x7684;&#x914D;&#x7F6E;&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>liquibase</code></td>
<td>&#x663E;&#x793A;&#x5DF2;&#x5E94;&#x7528;&#x7684; Liquibase &#x6570;&#x636E;&#x5E93;&#x8FC1;&#x79FB;&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>metrics</code></td>
<td>&#x663E;&#x793A;&#x5F53;&#x524D;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x7684;&#x6307;&#x6807;&#x5EA6;&#x91CF;&#x4FE1;&#x606F;&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>mappings</code></td>
<td>&#x663E;&#x793A;&#x6240;&#x6709; <code>@RequestMapping</code> &#x8DEF;&#x5F84;&#x7684;&#x6574;&#x7406;&#x6E05;&#x5355;&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>scheduledtasks</code></td>
<td>&#x663E;&#x793A;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4E2D;&#x7684;&#x8C03;&#x5EA6;&#x4EFB;&#x52A1;&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>sessions</code></td>
<td>&#x5141;&#x8BB8;&#x4ECE; Spring Session &#x652F;&#x6301;&#x7684;&#x4F1A;&#x8BDD;&#x5B58;&#x50A8;&#x4E2D;&#x68C0;&#x7D22;&#x548C;&#x5220;&#x9664;&#x7528;&#x6237;&#x4F1A;&#x8BDD;&#x3002;&#x5F53;&#x4F7F;&#x7528; Spring Session &#x7684;&#x54CD;&#x5E94;&#x5F0F; Web &#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x652F;&#x6301;&#x65F6;&#x4E0D;&#x53EF;&#x7528;&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>shutdown</code></td>
<td>&#x6B63;&#x5E38;&#x5173;&#x95ED;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x3002;</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>threaddump</code></td>
<td>&#x6267;&#x884C;&#x7EBF;&#x7A0B; dump&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
</tbody>
</table>
<p>&#x5982;&#x679C;&#x4F60;&#x7684;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x662F; Web &#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#xFF08;Spring MVC&#x3001;Spring WebFlux &#x6216; Jersey&#xFF09;&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x9644;&#x52A0;&#x7AEF;&#x70B9;&#xFF1A;</p>
<table>
<thead>
<tr>
<th>ID</th>
<th>&#x63CF;&#x8FF0;</th>
<th style="text-align:center">&#x9ED8;&#x8BA4;&#x542F;&#x7528;</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>heapdump</code></td>
<td>&#x8FD4;&#x56DE;&#x4E00;&#x4E2A; <code>hprof</code> &#x5806; dump &#x6587;&#x4EF6;&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>jolokia</code></td>
<td>&#x901A;&#x8FC7; HTTP &#x66B4;&#x9732; JMX bean&#xFF08;&#x5F53; Jolokia &#x5728; classpath &#x4E0A;&#x65F6;&#xFF0C;&#x4E0D;&#x9002;&#x7528;&#x4E8E; WebFlux&#xFF09;&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>logfile</code></td>
<td>&#x8FD4;&#x56DE;&#x65E5;&#x5FD7;&#x6587;&#x4EF6;&#x7684;&#x5185;&#x5BB9;&#xFF08;&#x5982;&#x679C;&#x5DF2;&#x8BBE;&#x7F6E; <code>logging.file</code> &#x6216; <code>logging.path</code> &#x5C5E;&#x6027;&#xFF09;&#x3002;&#x652F;&#x6301;&#x4F7F;&#x7528; HTTP <code>Range</code> &#x5934;&#x6765;&#x68C0;&#x7D22;&#x90E8;&#x5206;&#x65E5;&#x5FD7;&#x6587;&#x4EF6;&#x7684;&#x5185;&#x5BB9;&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>prometheus</code></td>
<td>&#x4EE5;&#x53EF;&#x4EE5;&#x7531; Prometheus &#x670D;&#x52A1;&#x5668;&#x6293;&#x53D6;&#x7684;&#x683C;&#x5F0F;&#x66B4;&#x9732;&#x6307;&#x6807;&#x3002;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
</tbody>
</table>
<p>&#x60F3;&#x4E86;&#x89E3;&#x6709;&#x5173; Actuator &#x7AEF;&#x70B9;&#x53CA;&#x5176;&#x8BF7;&#x6C42;&#x548C;&#x54CD;&#x5E94;&#x683C;&#x5F0F;&#x7684;&#x66F4;&#x591A;&#x4FE1;&#x606F;&#xFF0C;&#x8BF7;&#x53C2;&#x9605;&#x5355;&#x72EC;&#x7684; API &#x6587;&#x6863;&#xFF08;<a href="https://docs.spring.io/spring-boot/docs/2.1.3.RELEASE/actuator-api//html" target="_blank">HTML</a> &#x6216; <a href="https://docs.spring.io/spring-boot/docs/2.1.3.RELEASE/actuator-api//pdf/spring-boot-actuator-web-api.pdf" target="_blank">PDF</a>&#xFF09;&#x3002;</p>
<p><a id="production-ready-endpoints-enabling-endpoints"></a></p>
<h3 id="531&#x3001;&#x542F;&#x7528;&#x7AEF;&#x70B9;">53.1&#x3001;&#x542F;&#x7528;&#x7AEF;&#x70B9;</h3>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;Actuator &#x542F;&#x7528;&#x9664; <code>shutdown</code> &#x4E4B;&#x5916;&#x7684;&#x6240;&#x6709;&#x7AEF;&#x70B9;&#x3002;&#x8981;&#x914D;&#x7F6E;&#x7AEF;&#x70B9;&#x7684;&#x542F;&#x7528;&#xFF0C;&#x8BF7;&#x4F7F;&#x7528;&#x5176; <code>management.endpoint.<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>id</span><span class="token punctuation">&gt;</span></span>.enabled</code> &#x5C5E;&#x6027;&#x3002;&#x4EE5;&#x4E0B;&#x793A;&#x4F8B;&#x5C55;&#x793A;&#x4E86;&#x5982;&#x4F55;&#x542F;&#x7528;&#x5173;&#x95ED;&#x7AEF;&#x70B9;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.endpoint.shutdown.enabled</span><span class="token attr-value"><span class="token punctuation">=</span>true</span>
</code></pre>
<p>&#x5982;&#x679C;&#x4F60;&#x5E0C;&#x671B;&#x7AEF;&#x70B9;&#x542F;&#x7528;&#x662F;&#x9009;&#x62E9;&#x6027;&#x52A0;&#x5165;&#x800C;&#x4E0D;&#x662F;&#x9009;&#x62E9;&#x6027;&#x9000;&#x51FA;&#xFF0C;&#x8BF7;&#x5C06; <code>management.endpoints.enabled-by-default</code> &#x5C5E;&#x6027;&#x8BBE;&#x7F6E;&#x4E3A; <code>false</code>&#xFF0C;&#x5E76;&#x4F7F;&#x7528;&#x5404;&#x4E2A;&#x7AEF;&#x70B9;&#x7684; <code>enabled</code> &#x5C5E;&#x6027;&#x91CD;&#x65B0;&#x52A0;&#x5165;&#x3002;&#x4EE5;&#x4E0B;&#x793A;&#x4F8B;&#x542F;&#x7528; <code>info</code> &#x7AEF;&#x70B9;&#x5E76;&#x7981;&#x7528;&#x6240;&#x6709;&#x5176;&#x4ED6;&#x7AEF;&#x70B9;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.endpoints.enabled-by-default</span><span class="token attr-value"><span class="token punctuation">=</span>false</span>
<span class="token constant">management.endpoint.info.enabled</span><span class="token attr-value"><span class="token punctuation">=</span>true</span>
</code></pre>
<p><strong>&#x6CE8;&#x610F;</strong></p>
<blockquote>
<p>&#x5DF2;&#x5B8C;&#x5168;&#x4ECE;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4E0A;&#x4E0B;&#x6587;&#x4E2D;&#x5220;&#x9664;&#x5DF2;&#x7981;&#x7528;&#x7684;&#x7AEF;&#x70B9;&#x3002;&#x5982;&#x679C;&#x53EA;&#x60F3;&#x66F4;&#x6539;&#x7AEF;&#x70B9;&#x6240;&#x66B4;&#x9732;&#x7684;&#x6280;&#x672F;&#xFF0C;&#x8BF7;&#x6539;&#x7528; <a href="#production-ready-endpoints-exposing-endpoints"><code>include</code> &#x548C; <code>exclude</code> &#x5C5E;&#x6027;</a>&#x3002;</p>
</blockquote>
<p><a id="production-ready-endpoints-exposing-endpoints"></a></p>
<h3 id="532&#x3001;&#x66B4;&#x9732;&#x7AEF;&#x70B9;">53.2&#x3001;&#x66B4;&#x9732;&#x7AEF;&#x70B9;</h3>
<p>&#x7531;&#x4E8E;&#x7AEF;&#x70B9;&#x53EF;&#x80FD;&#x5305;&#x542B;&#x654F;&#x611F;&#x4FE1;&#x606F;&#xFF0C;&#x56E0;&#x6B64;&#x5E94;&#x4ED4;&#x7EC6;&#x8003;&#x8651;&#x4F55;&#x65F6;&#x66B4;&#x9732;&#x5B83;&#x4EEC;&#x3002;&#x4E0B;&#x8868;&#x663E;&#x793A;&#x4E86;&#x5185;&#x7F6E;&#x7AEF;&#x70B9;&#x548C;&#x9ED8;&#x8BA4;&#x66B4;&#x9732;&#x60C5;&#x51B5;&#xFF1A;</p>
<table>
<thead>
<tr>
<th>ID</th>
<th>JMX</th>
<th style="text-align:center">Web</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>auditevents</code></td>
<td>&#x662F;</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>beans</code></td>
<td>&#x662F;</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>caches</code></td>
<td>&#x662F;</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>conditions</code></td>
<td>&#x662F;</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>configprops</code></td>
<td>&#x662F;</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>env</code></td>
<td>&#x662F;</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>flyway</code></td>
<td>&#x662F;</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>health</code></td>
<td>&#x662F;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>heapdump</code></td>
<td>N/A</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>httptrace</code></td>
<td>&#x662F;</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>info</code></td>
<td>&#x662F;</td>
<td style="text-align:center">&#x662F;</td>
</tr>
<tr>
<td><code>integrationgraph</code></td>
<td>&#x662F;</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>jolokia</code></td>
<td>N/A</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>logfile</code></td>
<td>N/A</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>loggers</code></td>
<td>&#x662F;</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>liquibase</code></td>
<td>&#x662F;</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>metrics</code></td>
<td>&#x662F;</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>mappings</code></td>
<td>&#x662F;</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>prometheus</code></td>
<td>N/A</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>scheduledtasks</code></td>
<td>&#x662F;</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>sessions</code></td>
<td>&#x662F;</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>shutdown</code></td>
<td>&#x662F;</td>
<td style="text-align:center">&#x5426;</td>
</tr>
<tr>
<td><code>threaddump</code></td>
<td>&#x662F;</td>
<td style="text-align:center">&#x5426;</td>
</tr>
</tbody>
</table>
<p>&#x8981;&#x66F4;&#x6539;&#x66B4;&#x9732;&#x7684;&#x7AEF;&#x70B9;&#xFF0C;&#x8BF7;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x7279;&#x5B9A;&#x7684; <code>include</code> &#x548C; <code>exclude</code> &#x5C5E;&#x6027;&#xFF1A;</p>
<table>
<thead>
<tr>
<th>&#x5C5E;&#x6027;</th>
<th>&#x9ED8;&#x8BA4;</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>management.endpoints.jmx.exposure.exclude</code></td>
<td></td>
</tr>
<tr>
<td><code>management.endpoints.jmx.exposure.include</code></td>
<td><code>*</code></td>
</tr>
<tr>
<td><code>management.endpoints.web.exposure.exclude</code></td>
<td></td>
</tr>
<tr>
<td><code>management.endpoints.web.exposure.include</code></td>
<td><code>info, health</code></td>
</tr>
</tbody>
</table>
<p><code>include</code> &#x5C5E;&#x6027;&#x5217;&#x51FA;&#x4E86;&#x66B4;&#x9732;&#x7684;&#x7AEF;&#x70B9;&#x7684; ID&#x3002;<code>exclude</code> &#x5C5E;&#x6027;&#x5217;&#x51FA;&#x4E86;&#x4E0D;&#x5E94;&#x66B4;&#x9732;&#x7684;&#x7AEF;&#x70B9;&#x7684; ID&#x3002;<code>exclude</code> &#x5C5E;&#x6027;&#x4F18;&#x5148;&#x4E8E; <code>include</code> &#x5C5E;&#x6027;&#x3002;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x7AEF;&#x70B9; ID &#x5217;&#x8868;&#x914D;&#x7F6E; <code>include</code> &#x548C; <code>exclude</code> &#x5C5E;&#x6027;&#x3002;</p>
<p>&#x4F8B;&#x5982;&#xFF0C;&#x8981;&#x505C;&#x6B62;&#x901A;&#x8FC7; JMX &#x66B4;&#x9732;&#x6240;&#x6709;&#x7AEF;&#x70B9;&#x5E76;&#x4EC5;&#x66B4;&#x9732; <code>health</code> &#x548C; <code>info</code> &#x7AEF;&#x70B9;&#xFF0C;&#x8BF7;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x5C5E;&#x6027;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.endpoints.jmx.exposure.include</span><span class="token attr-value"><span class="token punctuation">=</span>health,info</span>
</code></pre>
<p><code>*</code> &#x53EF;&#x7528;&#x4E8E;&#x9009;&#x62E9;&#x6240;&#x6709;&#x7AEF;&#x70B9;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x8981;&#x901A;&#x8FC7; HTTP &#x66B4;&#x9732;&#x9664; <code>env</code> &#x548C; <code>beans</code> &#x4E4B;&#x5916;&#x7684;&#x6240;&#x6709;&#x7AEF;&#x70B9;&#xFF0C;&#x8BF7;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x5C5E;&#x6027;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.endpoints.web.exposure.include</span><span class="token attr-value"><span class="token punctuation">=</span>*</span>
<span class="token constant">management.endpoints.web.exposure.exclude</span><span class="token attr-value"><span class="token punctuation">=</span>env,beans</span>
</code></pre>
<p><strong>&#x6CE8;&#x610F;</strong></p>
<blockquote>

`*` &#x5728; YAML &#x4E2D;&#x5177;&#x6709;&#x7279;&#x6B8A;&#x542B;&#x4E49;&#xFF0C;&#x56E0;&#x6B64;&#x5982;&#x679C;&#x8981;&#x5305;&#x542B;&#xFF08;&#x6216;&#x6392;&#x9664;&#xFF09;&#x6240;&#x6709;&#x7AEF;&#x70B9;&#xFF0C;&#x8BF7;&#x52A1;&#x5FC5;&#x6DFB;&#x52A0;&#x5F15;&#x53F7;&#xFF0C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#xFF1A;

```yaml
management:
  endpoints:
    web:
      exposure:
        include: &quot;*&quot;
```

</blockquote>

<p><strong>&#x6CE8;&#x610F;</strong></p>
<blockquote>
<p>&#x5982;&#x679C;&#x4F60;&#x7684;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x662F;&#x516C;&#x5F00;&#x7684;&#xFF0C;&#x6211;&#x4EEC;&#x5F3A;&#x70C8;&#x5EFA;&#x8BAE;&#x4F60;&#x4E5F;<a href="#production-ready-endpoints-security">&#x4FDD;&#x62A4;&#x4F60;&#x7684;&#x7AEF;&#x70B9;</a>&#x3002;</p>
</blockquote>
<p><strong>&#x63D0;&#x793A;</strong></p>
<blockquote>
<p>&#x5982;&#x679C;&#x8981;&#x5728;&#x66B4;&#x9732;&#x7AEF;&#x70B9;&#x65F6;&#x5B9E;&#x73B0;&#x81EA;&#x5DF1;&#x7684;&#x7B56;&#x7565;&#xFF0C;&#x53EF;&#x4EE5;&#x6CE8;&#x518C;&#x4E00;&#x4E2A; <code>EndpointFilter</code> bean&#x3002;</p>
</blockquote>
<p><a id="production-ready-endpoints-security"></a></p>
<h3 id="533&#x3001;&#x4FDD;&#x62A4;-http-&#x7AEF;&#x70B9;">53.3&#x3001;&#x4FDD;&#x62A4; HTTP &#x7AEF;&#x70B9;</h3>
<p>&#x4F60;&#x5E94;&#x8BE5;&#x50CF;&#x4FDD;&#x62A4;&#x6240;&#x6709;&#x5176;&#x4ED6;&#x654F;&#x611F; URL &#x4E00;&#x6837;&#x6CE8;&#x610F;&#x4FDD;&#x62A4; HTTP &#x7AEF;&#x70B9;&#x3002;&#x5982;&#x679C;&#x5B58;&#x5728; Spring Security&#xFF0C;&#x5219;&#x9ED8;&#x8BA4;&#x4F7F;&#x7528; Spring Security &#x7684;&#x5185;&#x5BB9;&#x534F;&#x5546;&#x7B56;&#x7565;&#x6765;&#x4FDD;&#x62A4;&#x7AEF;&#x70B9;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x5982;&#x679C;&#x4F60;&#x5E0C;&#x671B;&#x4E3A; HTTP &#x7AEF;&#x70B9;&#x914D;&#x7F6E;&#x81EA;&#x5B9A;&#x4E49;&#x5B89;&#x5168;&#x7B56;&#x7565;&#xFF0C;&#x53EA;&#x5141;&#x8BB8;&#x5177;&#x6709;&#x7279;&#x5B9A;&#x89D2;&#x8272;&#x8EAB;&#x4EFD;&#x7684;&#x7528;&#x6237;&#x8BBF;&#x95EE;&#x5B83;&#x4EEC;&#xFF0C;Spring Boot &#x63D0;&#x4F9B;&#x4E86;&#x65B9;&#x4FBF;&#x7684; <code>RequestMatcher</code> &#x5BF9;&#x8C61;&#xFF0C;&#x53EF;&#x4EE5;&#x4E0E; Spring Security &#x7ED3;&#x5408;&#x4F7F;&#x7528;&#x3002;</p>
<p>&#x5178;&#x578B;&#x7684; Spring Security &#x914D;&#x7F6E;&#x53EF;&#x80FD;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre class="language-"><code class="lang-java"><span class="token annotation punctuation">@Configuration</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">ActuatorSecurity</span> <span class="token keyword">extends</span> <span class="token class-name">WebSecurityConfigurerAdapter</span> <span class="token punctuation">{</span>

    <span class="token annotation punctuation">@Override</span>
    <span class="token keyword">protected</span> <span class="token keyword">void</span> <span class="token function">configure</span><span class="token punctuation">(</span><span class="token class-name">HttpSecurity</span> http<span class="token punctuation">)</span> <span class="token keyword">throws</span> <span class="token class-name">Exception</span> <span class="token punctuation">{</span>
        http<span class="token punctuation">.</span><span class="token function">requestMatcher</span><span class="token punctuation">(</span><span class="token class-name">EndpointRequest</span><span class="token punctuation">.</span><span class="token function">toAnyEndpoint</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">authorizeRequests</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
                <span class="token punctuation">.</span><span class="token function">anyRequest</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">hasRole</span><span class="token punctuation">(</span><span class="token string">&quot;ENDPOINT_ADMIN&quot;</span><span class="token punctuation">)</span>
                <span class="token punctuation">.</span><span class="token function">and</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
            <span class="token punctuation">.</span><span class="token function">httpBasic</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

<span class="token punctuation">}</span>
</code></pre>
<p>&#x4E0A;&#x9762;&#x7684;&#x793A;&#x4F8B;&#x4F7F;&#x7528; <code>EndpointRequest.toAnyEndpoint()</code> &#x5C06;&#x8BF7;&#x6C42;&#x4E0E;&#x6240;&#x6709;&#x7AEF;&#x70B9;&#x8FDB;&#x884C;&#x5339;&#x914D;&#xFF0C;&#x7136;&#x540E;&#x786E;&#x4FDD;&#x6240;&#x6709;&#x7AEF;&#x70B9;&#x90FD;&#x5177;&#x6709; <code>ENDPOINT_ADMIN</code> &#x89D2;&#x8272;&#x3002;<code>EndpointRequest</code> &#x4E0A;&#x8FD8;&#x63D0;&#x4F9B;&#x4E86;&#x5176;&#x4ED6;&#x51E0;&#x79CD;&#x5339;&#x914D;&#x5668;&#x65B9;&#x6CD5;&#x3002;&#x6709;&#x5173;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#xFF0C;&#x8BF7;&#x53C2;&#x9605; API &#x6587;&#x6863;&#xFF08;<a href="https://docs.spring.io/spring-boot/docs/2.1.3.RELEASE/actuator-api//html" target="_blank">HTML</a>&#x6216; <a href="https://docs.spring.io/spring-boot/docs/2.1.3.RELEASE/actuator-api//pdf/spring-boot-actuator-web-api.pdf" target="_blank">PDF</a>&#xFF09;&#x3002;</p>
<p>&#x5982;&#x679C;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x90E8;&#x7F72;&#x5728;&#x6709;&#x9632;&#x706B;&#x5899;&#x7684;&#x73AF;&#x5883;&#xFF0C;&#x4F60;&#x53EF;&#x80FD;&#x5E0C;&#x671B;&#x65E0;&#x9700;&#x8EAB;&#x4EFD;&#x9A8C;&#x8BC1;&#x5373;&#x53EF;&#x8BBF;&#x95EE;&#x6240;&#x6709; Actuator &#x7AEF;&#x70B9;&#x3002;&#x4F60;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x66F4;&#x6539; <code>management.endpoints.web.exposure.include</code> &#x5C5E;&#x6027;&#x6765;&#x6267;&#x884C;&#x6B64;&#x64CD;&#x4F5C;&#xFF0C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#xFF1A;</p>
<p><strong>application.properties</strong></p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.endpoints.web.exposure.include</span><span class="token attr-value"><span class="token punctuation">=</span>*</span>
</code></pre>
<p>&#x6B64;&#x5916;&#xFF0C;&#x5982;&#x679C;&#x5B58;&#x5728; Spring Security&#xFF0C;&#x5219;&#x9700;&#x8981;&#x6DFB;&#x52A0;&#x81EA;&#x5B9A;&#x4E49;&#x5B89;&#x5168;&#x914D;&#x7F6E;&#xFF0C;&#x4EE5;&#x5141;&#x8BB8;&#x5BF9;&#x7AEF;&#x70B9;&#x8FDB;&#x884C;&#x672A;&#x7ECF;&#x8EAB;&#x4EFD;&#x9A8C;&#x8BC1;&#x7684;&#x8BBF;&#x95EE;&#xFF0C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#xFF1A;</p>
<pre class="language-"><code class="lang-java"><span class="token annotation punctuation">@Configuration</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">ActuatorSecurity</span> <span class="token keyword">extends</span> <span class="token class-name">WebSecurityConfigurerAdapter</span> <span class="token punctuation">{</span>

    <span class="token annotation punctuation">@Override</span>
    <span class="token keyword">protected</span> <span class="token keyword">void</span> <span class="token function">configure</span><span class="token punctuation">(</span><span class="token class-name">HttpSecurity</span> http<span class="token punctuation">)</span> <span class="token keyword">throws</span> <span class="token class-name">Exception</span> <span class="token punctuation">{</span>
        http<span class="token punctuation">.</span><span class="token function">requestMatcher</span><span class="token punctuation">(</span><span class="token class-name">EndpointRequest</span><span class="token punctuation">.</span><span class="token function">toAnyEndpoint</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">authorizeRequests</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
            <span class="token punctuation">.</span><span class="token function">anyRequest</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">permitAll</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

<span class="token punctuation">}</span>
</code></pre>
<p><a id="production-ready-endpoints-caching"></a></p>
<h3 id="534&#x3001;&#x914D;&#x7F6E;&#x7AEF;&#x70B9;">53.4&#x3001;&#x914D;&#x7F6E;&#x7AEF;&#x70B9;</h3>
<p>&#x7AEF;&#x70B9;&#x5BF9;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x8BFB;&#x53D6;&#x64CD;&#x4F5C;&#x7684;&#x54CD;&#x5E94;&#x81EA;&#x52A8;&#x7F13;&#x5B58;&#x3002;&#x8981;&#x914D;&#x7F6E;&#x7AEF;&#x70B9;&#x7F13;&#x5B58;&#x54CD;&#x5E94;&#x7684;&#x65F6;&#x95F4;&#x957F;&#x5EA6;&#xFF0C;&#x8BF7;&#x4F7F;&#x7528;&#x5176; <code>cache.time-to-live</code> &#x5C5E;&#x6027;&#x3002;&#x4EE5;&#x4E0B;&#x793A;&#x4F8B;&#x5C06;beans&#x7AEF;&#x70B9;&#x7F13;&#x5B58;&#x7684;&#x751F;&#x5B58;&#x65F6;&#x95F4;&#x8BBE;&#x7F6E;&#x4E3A;10&#x79D2;&#xFF1A;</p>
<p><strong>application.properties</strong></p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.endpoint.beans.cache.time-to-live</span><span class="token attr-value"><span class="token punctuation">=</span>10s</span>
</code></pre>
<p><strong>&#x6CE8;&#x610F;</strong></p>
<blockquote>
<p>&#x524D;&#x7F00; <code>management.endpoint.<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>name</span><span class="token punctuation">&gt;</span></span></code> &#x7528;&#x4E8E;&#x552F;&#x4E00;&#x6807;&#x8BC6;&#x914D;&#x7F6E;&#x7684;&#x7AEF;&#x70B9;&#x3002;</p>
</blockquote>
<p><strong>&#x6CE8;&#x610F;</strong></p>
<blockquote>
<p>&#x5728;&#x8FDB;&#x884C;&#x4E00;&#x4E2A;&#x8EAB;&#x4EFD;&#x9A8C;&#x8BC1; HTTP &#x8BF7;&#x6C42;&#x65F6;&#xFF0C;<code>Principal</code> &#x88AB;&#x89C6;&#x4E3A;&#x7AEF;&#x70B9;&#x7684;&#x8F93;&#x5165;&#xFF0C;&#x56E0;&#x6B64;&#x4E0D;&#x4F1A;&#x7F13;&#x5B58;&#x54CD;&#x5E94;&#x3002;</p>
</blockquote>
<p><a id="production-ready-endpoints-hypermedia"></a></p>
<h3 id="535&#x3001;actuator-web-&#x7AEF;&#x70B9;&#x8D85;&#x5A92;&#x4F53;">53.5&#x3001;Actuator Web &#x7AEF;&#x70B9;&#x8D85;&#x5A92;&#x4F53;</h3>
<p>&#x6DFB;&#x52A0; <strong>discovery page</strong>&#xFF0C;&#x5176;&#x5305;&#x542B;&#x6307;&#x5411;&#x6240;&#x6709;&#x7AEF;&#x70B9;&#x7684;&#x94FE;&#x63A5;&#x3002;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;<strong>discovery page</strong> &#x5728; <code>/actuator</code> &#x4E0A;&#x53EF;&#x8BBF;&#x95EE;&#x3002;</p>
<p>&#x914D;&#x7F6E;&#x4E00;&#x4E2A;&#x81EA;&#x5B9A;&#x4E49;&#x7BA1;&#x7406;&#x4E0A;&#x4E0B;&#x6587;&#xFF08;management context&#xFF09;&#x8DEF;&#x5F84;&#x65F6;&#xFF0C;<strong>discovery page</strong> &#x4F1A;&#x81EA;&#x52A8;&#x4ECE; <code>/actuator</code> &#x79FB;&#x52A8;&#x5230;&#x7BA1;&#x7406;&#x4E0A;&#x4E0B;&#x6587;&#x7684;&#x6839;&#x76EE;&#x5F55;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x5982;&#x679C;&#x7BA1;&#x7406;&#x4E0A;&#x4E0B;&#x6587;&#x8DEF;&#x5F84;&#x662F; <code>/management</code>&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x4ECE; <code>/management</code> &#x83B7;&#x53D6; discovery page&#x3002;&#x5F53;&#x7BA1;&#x7406;&#x4E0A;&#x4E0B;&#x6587;&#x8DEF;&#x5F84;&#x8BBE;&#x7F6E;&#x4E3A; <code>/</code> &#x65F6;&#xFF0C;&#x5C06;&#x7981;&#x7528;&#x53D1;&#x73B0;&#x9875;&#x9762;&#x4EE5;&#x9632;&#x6B62;&#x4E0E;&#x5176;&#x4ED6;&#x6620;&#x5C04;&#x51B2;&#x7A81;&#x3002;</p>
<p><a id="production-ready-endpoints-cors"></a></p>
<h3 id="536&#x3001;&#x8DE8;&#x57DF;&#x652F;&#x6301;">53.6&#x3001;&#x8DE8;&#x57DF;&#x652F;&#x6301;</h3>
<p><a href="https://en.wikipedia.org/wiki/Cross-origin_resource_sharing" target="_blank">&#x8DE8;&#x6E90;&#x8D44;&#x6E90;&#x5171;&#x4EAB;</a>&#xFF08;CORS&#xFF09;&#x662F;&#x4E00;&#x4E2A; <a href="https://www.w3.org/TR/cors/" target="_blank">W3C &#x89C4;&#x8303;</a>&#xFF0C;&#x5141;&#x8BB8;&#x4F60;&#x4EE5;&#x7075;&#x6D3B;&#x7684;&#x65B9;&#x5F0F;&#x6307;&#x5B9A;&#x6388;&#x6743;&#x7684;&#x8DE8;&#x57DF;&#x8BF7;&#x6C42;&#x7C7B;&#x578B;&#x3002;&#x5982;&#x679C;&#x4F60;&#x4F7F;&#x7528; Spring MVC &#x6216; Spring WebFlux&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x914D;&#x7F6E; Actuator &#x7684; Web &#x7AEF;&#x70B9;&#x4EE5;&#x652F;&#x6301;&#x6B64;&#x7C7B;&#x65B9;&#x6848;&#x3002;</p>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B; CORS &#x652F;&#x6301;&#x88AB;&#x7981;&#x7528;&#xFF0C;&#x4EC5;&#x5728;&#x8BBE;&#x7F6E;&#x4E86; <code>management.endpoints.web.cors.allowed-origins</code> &#x5C5E;&#x6027;&#x540E;&#x624D;&#x542F;&#x7528; CORS &#x652F;&#x6301;&#x3002;&#x4EE5;&#x4E0B;&#x914D;&#x7F6E;&#x5141;&#x8BB8;&#x6765;&#x81EA; <code>example.com</code> &#x57DF;&#x7684; GET &#x548C; POST &#x8C03;&#x7528;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.endpoints.web.cors.allowed-origins</span><span class="token attr-value"><span class="token punctuation">=</span>http://example.com</span>
<span class="token constant">management.endpoints.web.cors.allowed-methods</span><span class="token attr-value"><span class="token punctuation">=</span>GET,POST</span>
</code></pre>
<p><strong>&#x63D0;&#x793A;</strong></p>
<blockquote>
<p>&#x6709;&#x5173;&#x9009;&#x9879;&#x7684;&#x5B8C;&#x6574;&#x5217;&#x8868;&#xFF0C;&#x8BF7;&#x53C2;&#x9605; <a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/CorsEndpointProperties.java" target="_blank">CorsEndpointProperties</a>&#x3002;</p>
</blockquote>
<p><a id="production-ready-endpoints-custom"></a></p>
<h3 id="537&#x3001;&#x5B9E;&#x73B0;&#x81EA;&#x5B9A;&#x4E49;&#x7AEF;&#x70B9;">53.7&#x3001;&#x5B9E;&#x73B0;&#x81EA;&#x5B9A;&#x4E49;&#x7AEF;&#x70B9;</h3>
<p>&#x5982;&#x679C;&#x4F60;&#x6DFB;&#x52A0;&#x4E00;&#x4E2A;&#x4F7F;&#x7528;&#x4E86; <code>@Endpoint</code> &#x6CE8;&#x89E3;&#x7684; <code>@Bean</code>&#xFF0C;&#x5219;&#x4F7F;&#x7528; <code>@ReadOperation</code>&#x3001;<code>@WritOperation</code> &#x6216; <code>@DeleteOperation</code> &#x6CE8;&#x89E3;&#x7684;&#x6240;&#x6709;&#x65B9;&#x6CD5;&#x90FD;&#x5C06;&#x901A;&#x8FC7; JMX &#x81EA;&#x52A8;&#x66B4;&#x9732;&#xFF0C;&#x5E76;&#x4E14;&#x5728; Web &#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4E2D;&#x4E5F;&#x5C06;&#x901A;&#x8FC7; HTTP &#x66B4;&#x9732;&#x3002;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; Jersey&#x3001;Spring MVC &#x6216; Spring WebFlux &#x901A;&#x8FC7; HTTP &#x66B4;&#x9732;&#x7AEF;&#x70B9;&#x3002;</p>
<p>&#x4F60;&#x8FD8;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>@JmxEndpoint</code> &#x6216; <code>@WebEndpoint</code> &#x7F16;&#x5199;&#x7279;&#x5B9A;&#x6280;&#x672F;&#x7684;&#x7AEF;&#x70B9;&#x3002;&#x8FD9;&#x4E9B;&#x7AEF;&#x70B9;&#x4EC5;&#x9650;&#x4E8E;&#x5404;&#x81EA;&#x7684;&#x6280;&#x672F;&#x3002;&#x4F8B;&#x5982;&#xFF0C;<code>@WebEndpoint</code> &#x4EC5;&#x901A;&#x8FC7; HTTP &#x66B4;&#x9732;&#xFF0C;&#x800C;&#x4E0D;&#x662F; JMX&#x3002;</p>
<p>&#x4F60;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>@EndpointWebExtension</code> &#x548C; <code>@EndpointJmxExtension</code> &#x7F16;&#x5199;&#x7279;&#x5B9A;&#x6280;&#x672F;&#x7684;&#x6269;&#x5C55;&#x3002;&#x901A;&#x8FC7;&#x8FD9;&#x4E9B;&#x6CE8;&#x89E3;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x63D0;&#x4F9B;&#x7279;&#x5B9A;&#x6280;&#x672F;&#x7684;&#x64CD;&#x4F5C;&#x6765;&#x6269;&#x5145;&#x73B0;&#x6709;&#x7AEF;&#x70B9;&#x3002;</p>
<p>&#x6700;&#x540E;&#xFF0C;&#x5982;&#x679C;&#x4F60;&#x9700;&#x8981;&#x8BBF;&#x95EE;&#x7279;&#x5B9A; Web &#x6846;&#x67B6;&#x7684;&#x529F;&#x80FD;&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x5B9E;&#x73B0; Servlet &#x6216; Spring <code>@Controller</code> &#x548C; <code>@RestController</code> &#x7AEF;&#x70B9;&#xFF0C;&#x4F46;&#x4EE3;&#x4EF7;&#x662F;&#x5B83;&#x4EEC;&#x65E0;&#x6CD5;&#x901A;&#x8FC7; JMX &#x6216;&#x4F7F;&#x7528;&#x5176;&#x4ED6; Web &#x6846;&#x67B6;&#x3002;</p>
<p><a id="production-ready-endpoints-custom-input"></a></p>
<h4 id="5371&#x3001;&#x63A5;&#x6536;&#x8F93;&#x5165;">53.7.1&#x3001;&#x63A5;&#x6536;&#x8F93;&#x5165;</h4>
<p>&#x7AEF;&#x70B9;&#x4E0A;&#x7684;&#x64CD;&#x4F5C;&#x901A;&#x8FC7;&#x53C2;&#x6570;&#x63A5;&#x6536;&#x8F93;&#x5165;&#x3002;&#x901A;&#x8FC7; Web &#x66B4;&#x9732;&#x65F6;&#xFF0C;&#x8FD9;&#x4E9B;&#x53C2;&#x6570;&#x7684;&#x503C;&#x53D6;&#x81EA; URL &#x7684;&#x67E5;&#x8BE2;&#x53C2;&#x6570;&#x548C; JSON &#x8BF7;&#x6C42;&#x4F53;&#x3002;&#x901A;&#x8FC7; JMX &#x66B4;&#x9732;&#x65F6;&#xFF0C;&#x53C2;&#x6570;&#x5C06;&#x6620;&#x5C04;&#x5230; MBean &#x64CD;&#x4F5C;&#x7684;&#x53C2;&#x6570;&#x3002;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#x53C2;&#x6570;&#x662F;&#x5FC5;&#x987B;&#x7684;&#x3002;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>@org.springframework.lang.Nullable</code> &#x5BF9;&#x5B83;&#x4EEC;&#x8FDB;&#x884C;&#x6CE8;&#x89E3;&#xFF0C;&#x4F7F;&#x5B83;&#x4EEC;&#x6210;&#x4E3A;&#x53EF;&#x9009;&#x9879;&#x3002;</p>
<p>JSON &#x8BF7;&#x6C42;&#x4F53;&#x4E2D;&#x7684;&#x6BCF;&#x4E2A;&#x6839;&#x5C5E;&#x6027;&#x90FD;&#x53EF;&#x4EE5;&#x6620;&#x5C04;&#x5230;&#x7AEF;&#x70B9;&#x7684;&#x53C2;&#x6570;&#x3002;&#x8003;&#x8651;&#x4EE5;&#x4E0B; JSON &#x8BF7;&#x6C42;&#x4F53;&#xFF1A;</p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
    <span class="token property">&quot;name&quot;</span><span class="token operator">:</span> <span class="token string">&quot;test&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;counter&quot;</span><span class="token operator">:</span> <span class="token number">42</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x8FD9;&#x53EF;&#x7528;&#x4E8E;&#x8C03;&#x7528;&#x5E26;&#x6709; <code>String name</code> &#x548C; <code>int counter</code> &#x53C2;&#x6570;&#x7684;&#x5199;&#x64CD;&#x4F5C;&#x3002;</p>
<p><strong>&#x63D0;&#x793A;</strong></p>
<blockquote>
<p>&#x7531;&#x4E8E;&#x7AEF;&#x70B9;&#x4E0E;&#x6280;&#x672F;&#x65E0;&#x5173;&#xFF0C;&#x56E0;&#x6B64;&#x53EA;&#x80FD;&#x5728;&#x65B9;&#x6CD5;&#x7B7E;&#x540D;&#x4E2D;&#x6307;&#x5B9A;&#x7B80;&#x5355;&#x7C7B;&#x578B;&#x3002;&#x7279;&#x522B;&#x662F;&#x4E0D;&#x652F;&#x6301;&#x4F7F;&#x7528;&#x5B9A;&#x4E49;&#x4E00;&#x4E2A; <code>name</code> &#x548C; <code>counter</code> &#x5C5E;&#x6027;&#x7684;&#x81EA;&#x5B9A;&#x4E49;&#x7C7B;&#x578B;&#x58F0;&#x660E;&#x5355;&#x4E2A;&#x53C2;&#x6570;&#x3002;</p>
</blockquote>
<p><strong>&#x6CE8;&#x610F;</strong></p>
<blockquote>
<p>&#x8981;&#x5141;&#x8BB8;&#x5C06;&#x8F93;&#x5165;&#x6620;&#x5C04;&#x5230;&#x64CD;&#x4F5C;&#x65B9;&#x6CD5;&#x7684;&#x53C2;&#x6570;&#xFF0C;&#x5E94;&#x4F7F;&#x7528; <code>-parameters</code> &#x7F16;&#x8BD1;&#x5B9E;&#x73B0;&#x7AEF;&#x70B9;&#x7684; Java &#x4EE3;&#x7801;&#xFF0C;&#x5E76;&#x4E14;&#x5E94;&#x4F7F;&#x7528; <code>-java-parameters</code> &#x7F16;&#x8BD1;&#x5B9E;&#x73B0;&#x7AEF;&#x70B9;&#x7684; Kotlin &#x4EE3;&#x7801;&#x3002;&#x5982;&#x679C;&#x4F60;&#x4F7F;&#x7528;&#x7684;&#x662F; Spring Boot &#x7684; Gradle &#x63D2;&#x4EF6;&#xFF0C;&#x6216;&#x8005;&#x662F; Maven &#x548C; spring-boot-starter-parent&#xFF0C;&#x5219;&#x5B83;&#x4EEC;&#x4F1A;&#x81EA;&#x52A8;&#x6267;&#x884C;&#x6B64;&#x64CD;&#x4F5C;&#x3002;</p>
</blockquote>
<p><a id="production-ready-endpoints-custom-input-conversion"></a></p>
<h5 id="&#x8F93;&#x5165;&#x7C7B;&#x578B;&#x8F6C;&#x6362;">&#x8F93;&#x5165;&#x7C7B;&#x578B;&#x8F6C;&#x6362;</h5>
<p>&#x5982;&#x6709;&#x5FC5;&#x8981;&#xFF0C;&#x4F20;&#x9012;&#x7ED9;&#x7AEF;&#x70B9;&#x64CD;&#x4F5C;&#x65B9;&#x6CD5;&#x7684;&#x53C2;&#x6570;&#x5C06;&#x81EA;&#x52A8;&#x8F6C;&#x6362;&#x4E3A;&#x6240;&#x9700;&#x7C7B;&#x578B;&#x3002;&#x5728;&#x8C03;&#x7528;&#x64CD;&#x4F5C;&#x65B9;&#x6CD5;&#x4E4B;&#x524D;&#xFF0C;&#x4F7F;&#x7528; <code>ApplicationConversionService</code> &#x5B9E;&#x4F8B;&#x5C06;&#x901A;&#x8FC7; JMX &#x6216; HTTP &#x8BF7;&#x6C42;&#x63A5;&#x6536;&#x7684;&#x8F93;&#x5165;&#x8F6C;&#x6362;&#x4E3A;&#x6240;&#x9700;&#x7C7B;&#x578B;&#x3002;</p>
<p><a id="production-ready-endpoints-custom-web"></a></p>
<h4 id="5372&#x3001;&#x81EA;&#x5B9A;&#x4E49;-web-&#x7AEF;&#x70B9;">53.7.2&#x3001;&#x81EA;&#x5B9A;&#x4E49; Web &#x7AEF;&#x70B9;</h4>
<p><code>@Endpoint</code>&#x3001;<code>@WebEndpoint</code> &#x6216; <code>@EndpointWebExtension</code> &#x4E0A;&#x7684;&#x64CD;&#x4F5C;&#x5C06;&#x4F7F;&#x7528; Jersey&#x3001;Spring MVC &#x6216; Spring WebFlux &#x901A;&#x8FC7; HTTP &#x81EA;&#x52A8;&#x66B4;&#x9732;&#x3002;</p>
<p><a id="production-ready-endpoints-custom-web-predicate"></a></p>
<h5 id="web-&#x7AEF;&#x70B9;&#x8BF7;&#x6C42;&#x8C13;&#x8BCD;">Web &#x7AEF;&#x70B9;&#x8BF7;&#x6C42;&#x8C13;&#x8BCD;</h5>
<p>&#x4E3A; Web &#x66B4;&#x9732;&#x7684;&#x7AEF;&#x70B9;&#x4E0A;&#x7684;&#x6BCF;&#x4E2A;&#x64CD;&#x4F5C;&#x81EA;&#x52A8;&#x751F;&#x6210;&#x8BF7;&#x6C42;&#x8C13;&#x8BCD;&#x3002;</p>
<p><a id="production-ready-endpoints-custom-web-predicate-path"></a></p>
<h5 id="&#x8DEF;&#x5F84;">&#x8DEF;&#x5F84;</h5>
<p>&#x8C13;&#x8BCD;&#x7684;&#x8DEF;&#x5F84;&#x7531;&#x7AEF;&#x70B9;&#x7684; ID &#x548C; Web &#x66B4;&#x9732;&#x7684;&#x7AEF;&#x70B9;&#x7684;&#x57FA;&#x7840;&#x8DEF;&#x5F84;&#x786E;&#x5B9A;&#x3002;&#x9ED8;&#x8BA4;&#x57FA;&#x7840;&#x8DEF;&#x5F84;&#x662F; <code>/actuator</code>&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x6709; ID &#x4E3A; <code>sessions</code> &#x7684;&#x7AEF;&#x70B9;&#x5C06;&#x4F7F;&#x7528; <code>/actuator/sessions</code> &#x4F5C;&#x4E3A;&#x5176;&#x5728;&#x8C13;&#x8BCD;&#x4E2D;&#x7684;&#x8DEF;&#x5F84;&#x3002;</p>
<p>&#x901A;&#x8FC7;&#x4F7F;&#x7528; <code>@Selector</code> &#x6CE8;&#x89E3;&#x64CD;&#x4F5C;&#x65B9;&#x6CD5;&#x7684;&#x4E00;&#x4E2A;&#x6216;&#x591A;&#x4E2A;&#x53C2;&#x6570;&#xFF0C;&#x53EF;&#x4EE5;&#x8FDB;&#x4E00;&#x6B65;&#x81EA;&#x5B9A;&#x4E49;&#x8DEF;&#x5F84;&#x3002;&#x8FD9;&#x6837;&#x7684;&#x53C2;&#x6570;&#x4F5C;&#x4E3A;&#x8DEF;&#x5F84;&#x53D8;&#x91CF;&#x6DFB;&#x52A0;&#x5230;&#x8DEF;&#x5F84;&#x8C13;&#x8BCD;&#x4E2D;&#x3002;&#x8C03;&#x7528;&#x7AEF;&#x70B9;&#x64CD;&#x4F5C;&#x65F6;&#xFF0C;&#x53D8;&#x91CF;&#x7684;&#x503C;&#x5C06;&#x4F20;&#x9012;&#x7ED9;&#x64CD;&#x4F5C;&#x65B9;&#x6CD5;&#x3002;</p>
<p><a id="production-ready-endpoints-custom-web-predicate-http-method"></a></p>
<h5 id="http-&#x65B9;&#x6CD5;">HTTP &#x65B9;&#x6CD5;</h5>
<p>&#x8C13;&#x8BCD;&#x7684; HTTP &#x65B9;&#x6CD5;&#x7531;&#x64CD;&#x4F5C;&#x7C7B;&#x578B;&#x51B3;&#x5B9A;&#xFF0C;&#x5982;&#x4E0B;&#x8868;&#x6240;&#x793A;&#xFF1A;</p>
<table>
<thead>
<tr>
<th>&#x64CD;&#x4F5C;</th>
<th>HTTP &#x65B9;&#x6CD5;</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@ReadOperation</code></td>
<td><code>GET</code></td>
</tr>
<tr>
<td><code>@WriteOperation</code></td>
<td><code>POST</code></td>
</tr>
<tr>
<td><code>@DeleteOperation</code></td>
<td><code>DELETE</code></td>
</tr>
</tbody>
</table>
<p><a id="production-ready-endpoints-custom-web-predicate-consumes"></a></p>
<h5 id="consume">Consume</h5>
<p>&#x5BF9;&#x4E8E;&#x4F7F;&#x7528;&#x8BF7;&#x6C42;&#x4F53;&#x7684; <code>@WriteOperation</code>&#xFF08;HTTP <code>POST</code>&#xFF09;&#xFF0C;&#x8C13;&#x8BCD;&#x7684; consume &#x5B50;&#x53E5;&#x662F; <code>application/vnd.spring-boot.actuator.v2+json, application/json</code>&#x3002;&#x5BF9;&#x4E8E;&#x6240;&#x6709;&#x5176;&#x4ED6;&#x64CD;&#x4F5C;&#xFF0C;consume &#x5B50;&#x53E5;&#x4E3A;&#x7A7A;&#x3002;</p>
<p><a id="production-ready-endpoints-custom-web-predicate-produces"></a></p>
<h5 id="produce">Produce</h5>
<p>&#x8C13;&#x8BCD;&#x7684; produce &#x5B50;&#x53E5;&#x53EF;&#x4EE5;&#x7531; <code>@DeleteOperation</code>&#x3001;<code>@ReadOperation</code> &#x548C; <code>@WriteOperation</code> &#x6CE8;&#x89E3;&#x7684; <code>produce</code> &#x5C5E;&#x6027;&#x786E;&#x5B9A;&#x3002;&#x8BE5;&#x5C5E;&#x6027;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002;&#x5982;&#x679C;&#x672A;&#x4F7F;&#x7528;&#xFF0C;&#x5219;&#x81EA;&#x52A8;&#x786E;&#x5B9A; produce &#x5B50;&#x53E5;&#x3002;</p>
<p>&#x5982;&#x679C;&#x64CD;&#x4F5C;&#x65B9;&#x6CD5;&#x8FD4;&#x56DE; <code>void</code> &#x6216; <code>Void</code>&#xFF0C;&#x5219; produce &#x5B50;&#x53E5;&#x4E3A;&#x7A7A;&#x3002;&#x5982;&#x679C;&#x64CD;&#x4F5C;&#x65B9;&#x6CD5;&#x8FD4;&#x56DE; <code>org.springframework.core.io.Resource</code>&#xFF0C;&#x5219; produce &#x5B50;&#x53E5;&#x4E3A; <code>application/octet-stream</code>&#x3002;&#x5BF9;&#x4E8E;&#x6240;&#x6709;&#x5176;&#x4ED6;&#x64CD;&#x4F5C;&#xFF0C;produce &#x5B50;&#x53E5;&#x662F; <code>application/vnd.spring-boot.actuator.v2+json, application/json</code>&#x3002;</p>
<p><a id="production-ready-endpoints-custom-web-response-status"></a></p>
<h5 id="web-&#x7AEF;&#x70B9;&#x54CD;&#x5E94;&#x72B6;&#x6001;">Web &#x7AEF;&#x70B9;&#x54CD;&#x5E94;&#x72B6;&#x6001;</h5>
<p>&#x7AEF;&#x70B9;&#x64CD;&#x4F5C;&#x7684;&#x9ED8;&#x8BA4;&#x54CD;&#x5E94;&#x72B6;&#x6001;&#x53D6;&#x51B3;&#x4E8E;&#x64CD;&#x4F5C;&#x7C7B;&#x578B;&#xFF08;&#x8BFB;&#x53D6;&#x3001;&#x5199;&#x5165;&#x6216;&#x5220;&#x9664;&#xFF09;&#x4EE5;&#x53CA;&#x64CD;&#x4F5C;&#x8FD4;&#x56DE;&#x7684;&#x5185;&#x5BB9;&#xFF08;&#x5982;&#x679C;&#x6709;&#xFF09;&#x3002;</p>
<p><code>@ReadOperation</code> &#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x503C;&#xFF0C;&#x54CD;&#x5E94;&#x72B6;&#x6001;&#x4E3A; 200&#xFF08;OK&#xFF09;&#x3002;&#x5982;&#x679C;&#x5B83;&#x672A;&#x8FD4;&#x56DE;&#x503C;&#xFF0C;&#x5219;&#x54CD;&#x5E94;&#x72B6;&#x6001;&#x5C06;&#x4E3A; 404&#xFF08;&#x672A;&#x627E;&#x5230;&#xFF09;&#x3002;</p>
<p>&#x5982;&#x679C; <code>@WriteOperation</code> &#x6216; <code>@DeleteOperation</code> &#x8FD4;&#x56DE;&#x503C;&#xFF0C;&#x5219;&#x54CD;&#x5E94;&#x72B6;&#x6001;&#x5C06;&#x4E3A; 200&#xFF08;OK&#xFF09;&#x3002;&#x5982;&#x679C;&#x5B83;&#x6CA1;&#x6709;&#x8FD4;&#x56DE;&#x503C;&#xFF0C;&#x5219;&#x54CD;&#x5E94;&#x72B6;&#x6001;&#x5C06;&#x4E3A; 204&#xFF08;&#x65E0;&#x5185;&#x5BB9;&#xFF09;&#x3002;</p>
<p>&#x5982;&#x679C;&#x5728;&#x6CA1;&#x6709;&#x5FC5;&#x9700;&#x53C2;&#x6570;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#x8C03;&#x7528;&#x64CD;&#x4F5C;&#xFF0C;&#x6216;&#x8005;&#x4F7F;&#x7528;&#x65E0;&#x6CD5;&#x8F6C;&#x6362;&#x4E3A;&#x6240;&#x9700;&#x7C7B;&#x578B;&#x7684;&#x53C2;&#x6570;&#xFF0C;&#x5219;&#x4E0D;&#x4F1A;&#x8C03;&#x7528;&#x64CD;&#x4F5C;&#x65B9;&#x6CD5;&#xFF0C;&#x5E76;&#x4E14;&#x54CD;&#x5E94;&#x72B6;&#x6001;&#x5C06;&#x4E3A; 400&#xFF08;&#x9519;&#x8BEF;&#x8BF7;&#x6C42;&#xFF09;&#x3002;</p>
<p><a id="production-ready-endpoints-custom-web-range-requests"></a></p>
<h5 id="web-&#x7AEF;&#x70B9;&#x8303;&#x56F4;&#x8BF7;&#x6C42;">Web &#x7AEF;&#x70B9;&#x8303;&#x56F4;&#x8BF7;&#x6C42;</h5>
<p>&#x53EF;&#x7528; HTTP &#x8303;&#x56F4;&#x8BF7;&#x6C42;&#x8BF7;&#x6C42;&#x90E8;&#x5206; HTTP &#x8D44;&#x6E90;&#x3002;&#x4F7F;&#x7528; Spring MVC &#x6216; Spring Web Flux &#x65F6;&#xFF0C;&#x8FD4;&#x56DE; <code>org.springframework.core.io.Resource</code> &#x7684;&#x64CD;&#x4F5C;&#x4F1A;&#x81EA;&#x52A8;&#x652F;&#x6301;&#x8303;&#x56F4;&#x8BF7;&#x6C42;&#x3002;</p>
<p><strong>&#x6CE8;&#x610F;</strong></p>
<blockquote>
<p>&#x4F7F;&#x7528; Jersey &#x65F6;&#x4E0D;&#x652F;&#x6301;&#x8303;&#x56F4;&#x8BF7;&#x6C42;&#x3002;</p>
</blockquote>
<p><a id="production-ready-endpoints-custom-web-security"></a></p>
<h5 id="web-&#x7AEF;&#x70B9;&#x5B89;&#x5168;">Web &#x7AEF;&#x70B9;&#x5B89;&#x5168;</h5>
<p>Web &#x7AEF;&#x70B9;&#x6216;&#x7279;&#x5B9A; Web &#x7684;&#x7AEF;&#x70B9;&#x6269;&#x5C55;&#x4E0A;&#x7684;&#x64CD;&#x4F5C;&#x53EF;&#x4EE5;&#x63A5;&#x6536;&#x5F53;&#x524D;&#x7684; <code>java.security.Principal</code> &#x6216; <code>org.springframework.boot.actuate.endpoint.SecurityContext</code> &#x4F5C;&#x4E3A;&#x65B9;&#x6CD5;&#x53C2;&#x6570;&#x3002;&#x524D;&#x8005;&#x901A;&#x5E38;&#x4E0E; <code>@Nullable</code> &#x7ED3;&#x5408;&#x4F7F;&#x7528;&#xFF0C;&#x4E3A;&#x7ECF;&#x8FC7;&#x8EAB;&#x4EFD;&#x9A8C;&#x8BC1;&#x548C;&#x672A;&#x7ECF;&#x8EAB;&#x4EFD;&#x9A8C;&#x8BC1;&#x7684;&#x7528;&#x6237;&#x63D0;&#x4F9B;&#x4E0D;&#x540C;&#x7684;&#x884C;&#x4E3A;&#x3002;&#x540E;&#x8005;&#x901A;&#x5E38;&#x7528;&#x4E8E;&#x4F7F;&#x7528;&#x5176; <code>isUserInRole(String)</code> &#x65B9;&#x6CD5;&#x6267;&#x884C;&#x6388;&#x6743;&#x68C0;&#x67E5;&#x3002;</p>
<p><a id="production-ready-endpoints-custom-servlet"></a></p>
<h4 id="5373&#x3001;servlet-&#x7AEF;&#x70B9;">53.7.3&#x3001;Servlet &#x7AEF;&#x70B9;</h4>
<p>&#x901A;&#x8FC7;&#x5B9E;&#x73B0;&#x4E00;&#x4E2A;&#x5E26;&#x6709; <code>@ServletEndpoint</code> &#x6CE8;&#x89E3;&#x7684;&#x7C7B;&#xFF0C;<code>Servlet</code> &#x53EF;&#x4EE5;&#x4F5C;&#x4E3A;&#x7AEF;&#x70B9;&#x66B4;&#x9732;&#xFF0C;&#x8BE5;&#x7C7B;&#x4E5F;&#x5B9E;&#x73B0;&#x4E86; <code>Supplier<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>EndpointServlet</span><span class="token punctuation">&gt;</span></span></code>&#x3002;Servlet &#x7AEF;&#x70B9;&#x63D0;&#x4F9B;&#x4E86;&#x4E0E; Servlet &#x5BB9;&#x5668;&#x66F4;&#x6DF1;&#x5C42;&#x6B21;&#x7684;&#x96C6;&#x6210;&#xFF0C;&#x4F46;&#x4EE3;&#x4EF7;&#x662F;&#x53EF;&#x79FB;&#x690D;&#x6027;&#x3002;&#x5B83;&#x4EEC;&#x65E8;&#x5728;&#x7528;&#x4E8E;&#x5C06;&#x73B0;&#x6709; Servlet &#x4F5C;&#x4E3A;&#x7AEF;&#x70B9;&#x66B4;&#x9732;&#x3002;&#x5BF9;&#x4E8E;&#x65B0;&#x7AEF;&#x70B9;&#xFF0C;&#x5E94;&#x5C3D;&#x53EF;&#x80FD;&#x9996;&#x9009; <code>@Endpoint</code> &#x548C; <code>@WebEndpoint</code> &#x6CE8;&#x89E3;&#x3002;</p>
<p><a id="production-ready-endpoints-custom-controller"></a></p>
<h4 id="5374&#x3001;&#x63A7;&#x5236;&#x5668;&#x7AEF;&#x70B9;">53.7.4&#x3001;&#x63A7;&#x5236;&#x5668;&#x7AEF;&#x70B9;</h4>
<p><code>@ControllerEndpoint</code> &#x548C; <code>@RestControllerEndpoint</code> &#x53EF;&#x7528;&#x4E8E;&#x5B9E;&#x73B0;&#x4EC5;&#x7531; Spring MVC &#x6216; Spring WebFlux &#x66B4;&#x9732;&#x7684;&#x7AEF;&#x70B9;&#x3002;&#x4F7F;&#x7528; Spring MVC &#x548C; Spring WebFlux &#x7684;&#x6807;&#x51C6;&#x6CE8;&#x89E3;&#xFF08;&#x5982; <code>@RequestMapping</code> &#x548C; <code>@GetMapping</code>&#xFF09;&#x6620;&#x5C04;&#x65B9;&#x6CD5;&#xFF0C;&#x5E76;&#x5C06;&#x7AEF;&#x70B9;&#x7684; ID &#x7528;&#x4F5C;&#x8DEF;&#x5F84;&#x7684;&#x524D;&#x7F00;&#x3002;&#x63A7;&#x5236;&#x5668;&#x7AEF;&#x70B9;&#x63D0;&#x4F9B;&#x4E86;&#x4E0E; Spring &#x7684; Web &#x6846;&#x67B6;&#x66F4;&#x6DF1;&#x5C42;&#x6B21;&#x7684;&#x96C6;&#x6210;&#xFF0C;&#x4F46;&#x4EE3;&#x4EF7;&#x662F;&#x53EF;&#x79FB;&#x690D;&#x6027;&#x3002;&#x5E94;&#x5C3D;&#x53EF;&#x80FD;&#x9996;&#x9009; <code>@Endpoint</code> &#x548C; <code>@WebEndpoint</code> &#x6CE8;&#x89E3;&#x3002;</p>
<p><a id="production-ready-health"></a></p>
<h3 id="538&#x3001;&#x5065;&#x5EB7;&#x4FE1;&#x606F;">53.8&#x3001;&#x5065;&#x5EB7;&#x4FE1;&#x606F;</h3>
<p>&#x4F60;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x5065;&#x5EB7;&#x4FE1;&#x606F;&#x6765;&#x68C0;&#x67E5;&#x6B63;&#x5728;&#x8FD0;&#x884C;&#x7684;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x7684;&#x72B6;&#x6001;&#x3002;&#x76D1;&#x63A7;&#x8F6F;&#x4EF6;&#x7ECF;&#x5E38;&#x5728;&#x751F;&#x4EA7;&#x7CFB;&#x7EDF;&#x51FA;&#x73B0;&#x6545;&#x969C;&#x65F6;&#x4F7F;&#x7528;&#x5B83;&#x63D0;&#x9192;&#x67D0;&#x4EBA;&#x3002;<code>health</code> &#x7AEF;&#x70B9;&#x66B4;&#x9732;&#x7684;&#x4FE1;&#x606F;&#x53D6;&#x51B3;&#x4E8E; <code>management.endpoint.health.show-details</code> &#x5C5E;&#x6027;&#xFF0C;&#x8BE5;&#x5C5E;&#x6027;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x503C;&#x4E4B;&#x4E00;&#x8FDB;&#x884C;&#x914D;&#x7F6E;&#xFF1A;</p>
<table>
<thead>
<tr>
<th>&#x540D;&#x79F0;</th>
<th>&#x63CF;&#x8FF0;</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>never</code></td>
<td>&#x6C38;&#x8FDC;&#x4E0D;&#x4F1A;&#x663E;&#x793A;&#x7EC6;&#x8282;&#x3002;</td>
</tr>
<tr>
<td><code>when-authorized</code></td>
<td>&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#x4EC5;&#x5411;&#x6388;&#x6743;&#x7528;&#x6237;&#x663E;&#x793A;&#x3002;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>management.endpoint.health.roles</code> &#x914D;&#x7F6E;&#x6388;&#x6743;&#x89D2;&#x8272;&#x3002;</td>
</tr>
<tr>
<td><code>always</code></td>
<td>&#x5411;&#x6240;&#x6709;&#x7528;&#x6237;&#x663E;&#x793A;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#x3002;</td>
</tr>
</tbody>
</table>
<p>&#x9ED8;&#x8BA4;&#x503C;&#x4E3A; <code>never</code>&#x3002;&#x5F53;&#x7528;&#x6237;&#x5904;&#x4E8E;&#x4E00;&#x4E2A;&#x6216;&#x591A;&#x4E2A;&#x7AEF;&#x70B9;&#x7684;&#x89D2;&#x8272;&#x65F6;&#xFF0C;&#x5C06;&#x88AB;&#x89C6;&#x4E3A;&#x5DF2;&#x83B7;&#x5F97;&#x6388;&#x6743;&#x3002;&#x5982;&#x679C;&#x7AEF;&#x70B9;&#x6CA1;&#x6709;&#x914D;&#x7F6E;&#x89D2;&#x8272;&#xFF08;&#x9ED8;&#x8BA4;&#x503C;&#xFF09;&#xFF0C;&#x5219;&#x8BA4;&#x4E3A;&#x6240;&#x6709;&#x7ECF;&#x8FC7;&#x8EAB;&#x4EFD;&#x9A8C;&#x8BC1;&#x7684;&#x7528;&#x6237;&#x90FD;&#x5DF2;&#x83B7;&#x5F97;&#x6388;&#x6743;&#x3002;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>management.endpoint.health.roles</code> &#x5C5E;&#x6027;&#x914D;&#x7F6E;&#x89D2;&#x8272;&#x3002;</p>
<p><strong>&#x6CE8;&#x610F;</strong></p>
<blockquote>
<p>&#x5982;&#x679C;&#x4F60;&#x5DF2;&#x4FDD;&#x62A4;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x5E76;&#x5E0C;&#x671B;&#x4F7F;&#x7528; <code>always</code>&#xFF0C;&#x5219;&#x5B89;&#x5168;&#x914D;&#x7F6E;&#x5FC5;&#x987B;&#x5141;&#x8BB8;&#x7ECF;&#x8FC7;&#x8EAB;&#x4EFD;&#x9A8C;&#x8BC1;&#x548C;&#x672A;&#x7ECF;&#x8EAB;&#x4EFD;&#x9A8C;&#x8BC1;&#x7684;&#x7528;&#x6237;&#x5BF9;&#x5065;&#x5EB7;&#x7AEF;&#x70B9;&#x7684;&#x8BBF;&#x95EE;&#x3002;</p>
</blockquote>
<p>&#x5065;&#x5EB7;&#x4FE1;&#x606F;&#x662F;&#x4ECE; <a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthIndicatorRegistry.java" target="_blank"><code>HealthIndicatorRegistry</code></a> &#x7684;&#x5185;&#x5BB9;&#x4E2D;&#x6536;&#x96C6;&#x7684;&#xFF08;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;<code>ApplicationContext</code> &#x4E2D;&#x5B9A;&#x4E49;&#x7684;&#x6240;&#x6709; <a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthIndicator.java" target="_blank"><code>HealthIndicator</code></a> &#x5B9E;&#x4F8B;&#xFF09;&#x3002;Spring Boot &#x5305;&#x542B;&#x8BB8;&#x591A;&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x7684; <code>HealthIndicators</code>&#xFF0C;&#x4F60;&#x4E5F;&#x53EF;&#x4EE5;&#x81EA;&#x5DF1;&#x7F16;&#x5199;&#x3002;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x6700;&#x7EC8;&#x7CFB;&#x7EDF;&#x72B6;&#x6001;&#x7531; <code>HealthAggregator</code> &#x6839;&#x636E;&#x72B6;&#x6001;&#x7684;&#x6709;&#x5E8F;&#x5217;&#x8868;&#x5BF9;&#x6BCF;&#x4E2A; <code>HealthIndicator</code> &#x7684;&#x72B6;&#x6001;&#x8FDB;&#x884C;&#x6392;&#x5E8F;&#x3002;&#x6392;&#x5E8F;&#x5217;&#x8868;&#x4E2D;&#x7684;&#x7B2C;&#x4E00;&#x4E2A;&#x72B6;&#x6001;&#x4F5C;&#x4E3A;&#x6574;&#x4F53;&#x5065;&#x5EB7;&#x72B6;&#x6001;&#x3002;&#x5982;&#x679C;&#x6CA1;&#x6709; <code>HealthIndicator</code> &#x8FD4;&#x56DE;&#x4E00;&#x4E2A; <code>HealthAggregator</code> &#x5DF2;&#x77E5;&#x7684;&#x72B6;&#x6001;&#xFF0C;&#x5219;&#x4F7F;&#x7528; <code>UNKNOWN</code> &#x72B6;&#x6001;&#x3002;</p>
<p><strong>&#x63D0;&#x793A;</strong></p>
<blockquote>
<p><code>HealthIndicatorRegistry</code> &#x53EF;&#x7528;&#x4E8E;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x6CE8;&#x518C;&#x548C;&#x6CE8;&#x9500;&#x5065;&#x5EB7;&#x6307;&#x793A;&#x5668;&#x3002;</p>
</blockquote>
<p><a id="_auto_configured_healthindicators"></a></p>
<h4 id="5381&#x3001;&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x7684;-healthindicator">53.8.1&#x3001;&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x7684; HealthIndicator</h4>
<p>&#x9002;&#x5F53;&#x65F6;&#xFF0C;Spring Boot &#x4F1A;&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x4EE5;&#x4E0B; <code>HealthIndicator</code>&#xFF1A;</p>
<table>
<thead>
<tr>
<th>&#x540D;&#x79F0;</th>
<th>&#x63CF;&#x8FF0;</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cassandra/CassandraHealthIndicator.java" target="_blank"><code>CassandraHealthIndicator</code></a></td>
<td>&#x68C0;&#x67E5; Cassandra &#x6570;&#x636E;&#x5E93;&#x662F;&#x5426;&#x5DF2;&#x542F;&#x52A8;&#x3002;</td>
</tr>
<tr>
<td><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/couchbase/CouchbaseHealthIndicator.java" target="_blank"><code>CouchbaseHealthIndicator</code></a></td>
<td>&#x68C0;&#x67E5; Couchbase &#x96C6;&#x7FA4;&#x662F;&#x5426;&#x5DF2;&#x542F;&#x52A8;&#x3002;</td>
</tr>
<tr>
<td><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/DiskSpaceHealthIndicator.java" target="_blank"><code>DiskSpaceHealthIndicator</code></a></td>
<td>&#x68C0;&#x67E5;&#x662F;&#x5426;&#x78C1;&#x76D8;&#x7A7A;&#x95F4;&#x4E0D;&#x8DB3;&#x3002;</td>
</tr>
<tr>
<td><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/jdbc/DataSourceHealthIndicator.java" target="_blank"><code>DataSourceHealthIndicator</code></a></td>
<td>&#x68C0;&#x67E5;&#x662F;&#x5426;&#x53EF;&#x4EE5;&#x83B7;&#x5F97;&#x4E0E; <code>DataSource</code> &#x7684;&#x8FDE;&#x63A5;&#x3002;</td>
</tr>
<tr>
<td><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchHealthIndicator.java" target="_blank"><code>ElasticsearchHealthIndicator</code></a></td>
<td>&#x68C0;&#x67E5; Elasticsearch &#x96C6;&#x7FA4;&#x662F;&#x5426;&#x5DF2;&#x542F;&#x52A8;&#x3002;</td>
</tr>
<tr>
<td><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/influx/InfluxDbHealthIndicator.java" target="_blank"><code>InfluxDbHealthIndicator</code></a></td>
<td>&#x68C0;&#x67E5; InfluxDB &#x670D;&#x52A1;&#x5668;&#x662F;&#x5426;&#x5DF2;&#x542F;&#x52A8;&#x3002;</td>
</tr>
<tr>
<td><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/jms/JmsHealthIndicator.java" target="_blank"><code>JmsHealthIndicator</code></a></td>
<td>&#x68C0;&#x67E5; JMS broker &#x662F;&#x5426;&#x5DF2;&#x542F;&#x52A8;&#x3002;</td>
</tr>
<tr>
<td><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/mail/MailHealthIndicator.java" target="_blank"><code>MailHealthIndicator</code></a></td>
<td>&#x68C0;&#x67E5;&#x90AE;&#x4EF6;&#x670D;&#x52A1;&#x5668;&#x662F;&#x5426;&#x5DF2;&#x542F;&#x52A8;&#x3002;</td>
</tr>
<tr>
<td><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/mongo/MongoHealthIndicator.java" target="_blank"><code>MongoHealthIndicator</code></a></td>
<td>&#x68C0;&#x67E5; Mongo &#x6570;&#x636E;&#x5E93;&#x662F;&#x5426;&#x5DF2;&#x542F;&#x52A8;&#x3002;</td>
</tr>
<tr>
<td><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/neo4j/Neo4jHealthIndicator.java" target="_blank"><code>Neo4jHealthIndicator</code></a></td>
<td>&#x68C0;&#x67E5; Neo4j &#x670D;&#x52A1;&#x5668;&#x662F;&#x5426;&#x5DF2;&#x542F;&#x52A8;&#x3002;</td>
</tr>
<tr>
<td><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/amqp/RabbitHealthIndicator.java" target="_blank"><code>RabbitHealthIndicator</code></a></td>
<td>&#x68C0;&#x67E5; Rabbit &#x670D;&#x52A1;&#x5668;&#x662F;&#x5426;&#x5DF2;&#x542F;&#x52A8;&#x3002;</td>
</tr>
<tr>
<td><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/redis/RedisHealthIndicator.java" target="_blank"><code>RedisHealthIndicator</code></a></td>
<td>&#x68C0;&#x67E5; Redis &#x670D;&#x52A1;&#x5668;&#x662F;&#x5426;&#x5DF2;&#x542F;&#x52A8;&#x3002;</td>
</tr>
<tr>
<td><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/solr/SolrHealthIndicator.java" target="_blank"><code>SolrHealthIndicator</code></a></td>
<td>&#x68C0;&#x67E5; Solr &#x670D;&#x52A1;&#x5668;&#x662F;&#x5426;&#x5DF2;&#x542F;&#x52A8;&#x3002;</td>
</tr>
</tbody>
</table>
<p><strong>&#x63D0;&#x793A;</strong></p>
<blockquote>
<p>&#x4F60;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8BBE;&#x7F6E; <code>management.health.defaults.enabled</code> &#x5C5E;&#x6027;&#x6765;&#x7981;&#x7528;&#x5B83;&#x4EEC;&#x3002;</p>
</blockquote>
<p><a id="_writing_custom_healthindicators"></a></p>
<h4 id="5382&#x3001;&#x7F16;&#x5199;&#x81EA;&#x5B9A;&#x4E49;-healthindicator">53.8.2&#x3001;&#x7F16;&#x5199;&#x81EA;&#x5B9A;&#x4E49; HealthIndicator</h4>
<p>&#x8981;&#x63D0;&#x4F9B;&#x81EA;&#x5B9A;&#x4E49;&#x5065;&#x5EB7;&#x4FE1;&#x606F;&#xFF0C;&#x53EF;&#x4EE5;&#x6CE8;&#x518C;&#x5B9E;&#x73B0; <a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthIndicator.java" target="_blank"><code>HealthIndicator</code></a> &#x63A5;&#x53E3;&#x7684; Spring bean&#x3002;&#x4F60;&#x9700;&#x8981;&#x63D0;&#x4F9B; <code>health()</code> &#x65B9;&#x6CD5;&#x7684;&#x5B9E;&#x73B0;&#x5E76;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A; <code>Health</code> &#x54CD;&#x5E94;&#x3002;<code>Health</code> &#x54CD;&#x5E94;&#x5E94;&#x5305;&#x62EC;&#x4E00;&#x4E2A;&#x72B6;&#x6001;&#xFF0C;&#x5E76;&#x4E14;&#x53EF;&#x4EE5;&#x9009;&#x62E9;&#x5305;&#x62EC;&#x8981;&#x663E;&#x793A;&#x7684;&#x5176;&#x4ED6;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#x3002;&#x4EE5;&#x4E0B;&#x4EE3;&#x7801;&#x5C55;&#x793A;&#x4E86;&#x4E00;&#x4E2A; HealthIndicator &#x5B9E;&#x73B0;&#x793A;&#x4F8B;&#xFF1A;</p>
<pre class="language-"><code class="lang-java"><span class="token keyword">import</span> <span class="token namespace">org<span class="token punctuation">.</span>springframework<span class="token punctuation">.</span>boot<span class="token punctuation">.</span>actuate<span class="token punctuation">.</span>health</span><span class="token punctuation">.</span><span class="token class-name">Health</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token namespace">org<span class="token punctuation">.</span>springframework<span class="token punctuation">.</span>boot<span class="token punctuation">.</span>actuate<span class="token punctuation">.</span>health</span><span class="token punctuation">.</span><span class="token class-name">HealthIndicator</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token namespace">org<span class="token punctuation">.</span>springframework<span class="token punctuation">.</span>stereotype</span><span class="token punctuation">.</span><span class="token class-name">Component</span><span class="token punctuation">;</span>

<span class="token annotation punctuation">@Component</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">MyHealthIndicator</span> <span class="token keyword">implements</span> <span class="token class-name">HealthIndicator</span> <span class="token punctuation">{</span>

    <span class="token annotation punctuation">@Override</span>
    <span class="token keyword">public</span> <span class="token class-name">Health</span> <span class="token function">health</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">int</span> errorCode <span class="token operator">=</span> <span class="token function">check</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x6267;&#x884C;&#x67D0;&#x4E9B;&#x7279;&#x5B9A;&#x7684;&#x5065;&#x5EB7;&#x68C0;&#x67E5;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>errorCode <span class="token operator">!=</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token keyword">return</span> <span class="token class-name">Health</span><span class="token punctuation">.</span><span class="token function">down</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">withDetail</span><span class="token punctuation">(</span><span class="token string">&quot;Error Code&quot;</span><span class="token punctuation">,</span> errorCode<span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">build</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">return</span> <span class="token class-name">Health</span><span class="token punctuation">.</span><span class="token function">up</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">build</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

<span class="token punctuation">}</span>
</code></pre>
<p><strong>&#x6CE8;&#x610F;</strong></p>
<blockquote>
<p>&#x7ED9;&#x5B9A; <code>HealthIndicator</code> &#x7684;&#x6807;&#x8BC6;&#x7B26;&#x662F;&#x6CA1;&#x6709; <code>HealthIndicator</code> &#x540E;&#x7F00;&#x7684; bean &#x7684;&#x540D;&#x79F0;&#xFF08;&#x5982;&#x679C;&#x5B58;&#x5728;&#xFF09;&#x3002;&#x5728;&#x524D;&#x9762;&#x7684;&#x793A;&#x4F8B;&#x4E2D;&#xFF0C;&#x5065;&#x5EB7;&#x4FE1;&#x606F;&#x5728;&#x540D;&#x4E3A; <code>my</code> &#x7684;&#x6761;&#x76EE;&#x4E2D;&#x53EF;&#x7528;&#x3002;</p>
</blockquote>
<p>&#x9664;&#x4E86; Spring Boot &#x7684;&#x9884;&#x5B9A;&#x4E49; <a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Status.java" target="_blank"><code>Status</code></a> &#x7C7B;&#x578B;&#x4E4B;&#x5916;&#xFF0C;<code>Health</code> &#x8FD8;&#x53EF;&#x4EE5;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x8868;&#x793A;&#x65B0;&#x7CFB;&#x7EDF;&#x72B6;&#x6001;&#x7684;&#x81EA;&#x5B9A;&#x4E49; <code>Status</code>&#x3002;&#x5728;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x8FD8;&#x9700;&#x8981;&#x63D0;&#x4F9B; <a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthAggregator.java" target="_blank"><code>HealthAggregator</code></a> &#x63A5;&#x53E3;&#x7684;&#x81EA;&#x5B9A;&#x4E49;&#x5B9E;&#x73B0;&#xFF0C;&#x6216;&#x8005;&#x5FC5;&#x987B;&#x4F7F;&#x7528; <code>management.health.status.order</code> &#x914D;&#x7F6E;&#x5C5E;&#x6027;&#x914D;&#x7F6E;&#x9ED8;&#x8BA4;&#x5B9E;&#x73B0;&#x3002;</p>
<p>&#x4F8B;&#x5982;&#xFF0C;&#x5047;&#x8BBE;&#x5728;&#x4F60;&#x7684;&#x4E00;&#x4E2A; <code>HealthIndicator</code> &#x5B9E;&#x73B0;&#x4E2D;&#x4F7F;&#x7528;&#x4E86;&#x4EE3;&#x7801;&#x4E3A; <code>FATAL</code> &#x7684;&#x65B0; <code>Status</code>&#x3002;&#x9700;&#x8981;&#x914D;&#x7F6E;&#x4E25;&#x91CD;&#x6027;&#x987A;&#x5E8F;&#xFF0C;&#x8BF7;&#x5C06;&#x4EE5;&#x4E0B;&#x5C5E;&#x6027;&#x6DFB;&#x52A0;&#x5230;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x5C5E;&#x6027;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.health.status.order</span><span class="token attr-value"><span class="token punctuation">=</span>FATAL, DOWN, OUT_OF_SERVICE, UNKNOWN, UP</span>
</code></pre>
<p>&#x54CD;&#x5E94;&#x4E2D;&#x7684; HTTP &#x72B6;&#x6001;&#x7801;&#x53CD;&#x6620;&#x4E86;&#x6574;&#x4F53;&#x8FD0;&#x884C;&#x72B6;&#x51B5;&#xFF08;&#x4F8B;&#x5982;&#xFF0C;<code>UP</code> &#x6620;&#x5C04;&#x5230; 200&#xFF0C;&#x800C; <code>OUT_OF_SERVICE</code> &#x548C; <code>DOWN</code> &#x6620;&#x5C04;&#x5230; 503&#xFF09;&#x3002;&#x5982;&#x679C;&#x901A;&#x8FC7; HTTP &#x8BBF;&#x95EE;&#x5065;&#x5EB7;&#x7AEF;&#x70B9;&#xFF0C;&#x5219;&#x53EF;&#x80FD;&#x8FD8;&#x9700;&#x8981;&#x6CE8;&#x518C;&#x81EA;&#x5B9A;&#x4E49;&#x72B6;&#x6001;&#x6620;&#x5C04;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x4EE5;&#x4E0B;&#x5C5E;&#x6027;&#x5C06; <code>FATAL</code> &#x6620;&#x5C04;&#x5230; 503&#xFF08;&#x670D;&#x52A1;&#x4E0D;&#x53EF;&#x7528;&#xFF09;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.health.status.http-mapping.FATAL</span><span class="token attr-value"><span class="token punctuation">=</span>503</span>
</code></pre>
<p><strong>&#x63D0;&#x793A;</strong></p>
<blockquote>
<p>&#x5982;&#x679C;&#x9700;&#x8981;&#x63A7;&#x5236;&#x66F4;&#x591A;&#xFF0C;&#x53EF;&#x4EE5;&#x5B9A;&#x4E49;&#x81EA;&#x5DF1;&#x7684; <code>HealthStatusHttpMapper</code> bean&#x3002;</p>
</blockquote>
<p>&#x4E0B;&#x8868;&#x5C55;&#x793A;&#x4E86;&#x5185;&#x7F6E;&#x72B6;&#x6001;&#x7684;&#x9ED8;&#x8BA4;&#x72B6;&#x6001;&#x6620;&#x5C04;&#xFF1A;</p>
<table>
<thead>
<tr>
<th>&#x72B6;&#x6001;</th>
<th>&#x6620;&#x5C04;</th>
</tr>
</thead>
<tbody>
<tr>
<td>DOWN</td>
<td>SERVICE_UNAVAILABLE (503)</td>
</tr>
<tr>
<td>OUT_OF_SERVICE</td>
<td>SERVICE_UNAVAILABLE (503)</td>
</tr>
<tr>
<td>UP</td>
<td>&#x9ED8;&#x8BA4;&#x6CA1;&#x6709;&#x6620;&#x5C04;&#xFF0C;&#x56E0;&#x6B64;&#x72B6;&#x6001;&#x7801;&#x4E3A; 200</td>
</tr>
<tr>
<td>UNKNOWN</td>
<td>&#x9ED8;&#x8BA4;&#x6CA1;&#x6709;&#x6620;&#x5C04;&#xFF0C;&#x56E0;&#x6B64;&#x72B6;&#x6001;&#x7801;&#x4E3A; 200</td>
</tr>
</tbody>
</table>
<p><a id="reactive-health-indicators"></a></p>
<h4 id="5383&#x3001;&#x54CD;&#x5E94;&#x5F0F;&#x5065;&#x5EB7;&#x6307;&#x793A;&#x5668;">53.8.3&#x3001;&#x54CD;&#x5E94;&#x5F0F;&#x5065;&#x5EB7;&#x6307;&#x793A;&#x5668;</h4>
<p>&#x5BF9;&#x4E8E;&#x54CD;&#x5E94;&#x5F0F;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#xFF0C;&#x4F8B;&#x5982;&#x4F7F;&#x7528; Spring WebFlux &#x7684;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#xFF0C;<code>ReactiveHealthIndicator</code> &#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x4E2A;&#x975E;&#x963B;&#x585E;&#x7684;&#x63A5;&#x53E3;&#x6765;&#x83B7;&#x53D6;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x5065;&#x5EB7;&#x4FE1;&#x606F;&#x3002;&#x4E0E;&#x4F20;&#x7EDF;&#x7684; <code>HealthIndicator</code> &#x7C7B;&#x4F3C;&#xFF0C;&#x5065;&#x5EB7;&#x4FE1;&#x606F;&#x4ECE; <a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthIndicatorRegistry.java" target="_blank"><code>ReactiveHealthIndicatorRegistry</code></a> &#x7684;&#x5185;&#x5BB9;&#x4E2D;&#x6536;&#x96C6;&#xFF08;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;<code>ApplicationContext</code> &#x4E2D;&#x5B9A;&#x4E49;&#x7684;&#x6240;&#x6709; <a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthIndicator.java" target="_blank"><code>HealthIndicator</code></a> &#x548C; <a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthIndicator.java" target="_blank"><code>ReactiveHealthIndicator</code></a> &#x5B9E;&#x4F8B;&#xFF09;&#x3002;&#x4E0D;&#x68C0;&#x67E5;&#x54CD;&#x5E94;&#x5F0F; API &#x7684;&#x5E38;&#x89C4; <code>HealthIndicator</code>&#x5728;&#x5F39;&#x6027;&#x8C03;&#x5EA6;&#x7A0B;&#x5E8F;&#x4E0A;&#x6267;&#x884C;&#x3002;</p>
<p><strong>&#x63D0;&#x793A;</strong></p>
<blockquote>
<p>&#x5728;&#x54CD;&#x5E94;&#x5F0F;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4E2D;&#xFF0C;<code>ReactiveHealthIndicatorRegistry</code> &#x53EF;&#x7528;&#x4E8E;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x6CE8;&#x518C;&#x548C;&#x53D6;&#x6D88;&#x6CE8;&#x518C;&#x5065;&#x5EB7;&#x6307;&#x793A;&#x5668;&#x3002;</p>
</blockquote>
<p>&#x8981;&#x4ECE;&#x54CD;&#x5E94;&#x5F0F; API &#x63D0;&#x4F9B;&#x81EA;&#x5B9A;&#x4E49;&#x5065;&#x5EB7;&#x4FE1;&#x606F;&#xFF0C;&#x53EF;&#x4EE5;&#x6CE8;&#x518C;&#x5B9E;&#x73B0; <a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthIndicator.java" target="_blank"><code>ReactiveHealthIndicator</code></a> &#x63A5;&#x53E3;&#x7684; Spring bean&#x3002;&#x4EE5;&#x4E0B;&#x4EE3;&#x7801;&#x5C55;&#x793A;&#x4E86; <code>ReactiveHealthIndicator</code> &#x5B9E;&#x73B0;&#x7684;&#x793A;&#x4F8B;&#xFF1A;</p>
<pre class="language-"><code class="lang-java"><span class="token annotation punctuation">@Component</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">MyReactiveHealthIndicator</span> <span class="token keyword">implements</span> <span class="token class-name">ReactiveHealthIndicator</span> <span class="token punctuation">{</span>

    <span class="token annotation punctuation">@Override</span>
    <span class="token keyword">public</span> <span class="token class-name">Mono</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">Health</span><span class="token punctuation">&gt;</span></span> <span class="token function">health</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">return</span> <span class="token function">doHealthCheck</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token comment">// &#x6267;&#x884C;&#x4E00;&#x4E9B;&#x7279;&#x5B9A;&#x7684;&#x5065;&#x5EB7;&#x68C0;&#x67E5;&#x5E76;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A; Mono&lt;Health&gt;</span>
            <span class="token punctuation">.</span><span class="token function">onErrorResume</span><span class="token punctuation">(</span>ex <span class="token operator">-&gt;</span> <span class="token class-name">Mono</span><span class="token punctuation">.</span><span class="token function">just</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">Health</span><span class="token punctuation">.</span><span class="token class-name">Builder</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">down</span><span class="token punctuation">(</span>ex<span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">build</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

<span class="token punctuation">}</span>
</code></pre>
<p><strong>&#x63D0;&#x793A;</strong></p>
<blockquote>
<p>&#x8981;&#x81EA;&#x52A8;&#x5904;&#x7406;&#x9519;&#x8BEF;&#xFF0C;&#x8BF7;&#x8003;&#x8651;&#x4ECE; <code>AbstractReactiveHealthIndicator</code> &#x8FDB;&#x884C;&#x6269;&#x5C55;&#x3002;</p>
</blockquote>
<p><a id="_auto_configured_reactivehealthindicators"></a></p>
<h4 id="5384&#x3001;&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x7684;-reactivehealthindicator">53.8.4&#x3001;&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x7684; ReactiveHealthIndicator</h4>
<p>&#x9002;&#x5F53;&#x65F6;&#xFF0C;Spring Boot &#x4F1A;&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x4EE5;&#x4E0B; <code>ReactiveHealthIndicator</code>&#xFF1A;</p>
<table>
<thead>
<tr>
<th>&#x540D;&#x79F0;</th>
<th>&#x63CF;&#x8FF0;</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cassandra/CassandraReactiveHealthIndicator.java" target="_blank"><code>CassandraReactiveHealthIndicator</code></a></td>
<td>&#x68C0;&#x67E5; Cassandra &#x6570;&#x636E;&#x5E93;&#x662F;&#x5426;&#x5DF2;&#x542F;&#x52A8;&#x3002;</td>
</tr>
<tr>
<td><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/couchbase/CouchbaseReactiveHealthIndicator.java" target="_blank"><code>CouchbaseReactiveHealthIndicator</code></a></td>
<td>&#x68C0;&#x67E5; Couchbase &#x96C6;&#x7FA4;&#x662F;&#x5426;&#x5DF2;&#x542F;&#x52A8;&#x3002;</td>
</tr>
<tr>
<td><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/mongo/MongoReactiveHealthIndicator.java" target="_blank"><code>MongoReactiveHealthIndicator</code></a></td>
<td>&#x68C0;&#x67E5; Mongo &#x6570;&#x636E;&#x5E93;&#x662F;&#x5426;&#x5DF2;&#x542F;&#x52A8;&#x3002;</td>
</tr>
<tr>
<td><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/redis/RedisReactiveHealthIndicator.java" target="_blank"><code>RedisReactiveHealthIndicator</code></a></td>
<td>&#x68C0;&#x67E5; Redis &#x670D;&#x52A1;&#x5668;&#x662F;&#x5426;&#x5DF2;&#x542F;&#x52A8;&#x3002;</td>
</tr>
</tbody>
</table>
<p><strong>&#x63D0;&#x793A;</strong></p>
<blockquote>
<p>&#x5FC5;&#x8981;&#x65F6;&#xFF0C;&#x54CD;&#x5E94;&#x5F0F;&#x6307;&#x793A;&#x5668;&#x53D6;&#x4EE3;&#x5E38;&#x89C4;&#x6307;&#x793A;&#x5668;&#x3002;&#x6B64;&#x5916;&#xFF0C;&#x4EFB;&#x4F55;&#x672A;&#x660E;&#x786E;&#x5904;&#x7406;&#x7684; <code>HealthIndicator</code> &#x90FD;&#x4F1A;&#x81EA;&#x52A8;&#x5305;&#x88C5;&#x3002;</p>
</blockquote>
<p><a id="production-ready-application-info"></a></p>
<h3 id="539&#x3001;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4FE1;&#x606F;">53.9&#x3001;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4FE1;&#x606F;</h3>
<p>&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4FE1;&#x606F;&#x66B4;&#x9732;&#x4ECE; <code>ApplicationContext</code> &#x4E2D;&#x5B9A;&#x4E49;&#x7684;&#x6240;&#x6709; <a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/InfoContributor.java" target="_blank"><code>InfoContributor</code></a> bean &#x6536;&#x96C6;&#x7684;&#x5404;&#x79CD;&#x4FE1;&#x606F;&#x3002;Spring Boot &#x5305;&#x542B;&#x8BB8;&#x591A;&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x7684; <code>InfoContributor</code> bean&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x7F16;&#x5199;&#x81EA;&#x5DF1;&#x7684; bean&#x3002;</p>
<p><a id="production-ready-application-info"></a></p>
<h4 id="5391&#x3001;&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x7684;-infocontributor">53.9.1&#x3001;&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x7684; InfoContributor</h4>
<p>&#x9002;&#x5F53;&#x65F6;&#xFF0C;Spring Boot &#x4F1A;&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x4EE5;&#x4E0B; <code>InfoContributor</code> bean&#xFF1A;</p>
<table>
<thead>
<tr>
<th>&#x540D;&#x79F0;</th>
<th>&#x63CF;&#x8FF0;</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/EnvironmentInfoContributor.java" target="_blank"><code>EnvironmentInfoContributor</code></a></td>
<td>&#x5728; <code>info</code> key &#x4E0B;&#x663E;&#x793A; <code>Environment</code> &#x4E2D;&#x7684;&#x6240;&#x6709; key&#x3002;</td>
</tr>
<tr>
<td><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/GitInfoContributor.java" target="_blank"><code>GitInfoContributor</code></a></td>
<td>&#x5982;&#x679C; <code>git.properties</code> &#x53EF;&#x7528;&#x5219;&#x66B4;&#x9732; git &#x4FE1;&#x606F;&#x3002;</td>
</tr>
<tr>
<td><a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/BuildInfoContributor.java" target="_blank"><code>BuildInfoContributor</code></a></td>
<td>&#x5982;&#x679C; <code>META-INF/build-info.properties</code> &#x53EF;&#x7528;&#x5219;&#x66B4;&#x9732;&#x6784;&#x5EFA;&#x4FE1;&#x606F;&#x3002;</td>
</tr>
</tbody>
</table>
<p><strong>&#x63D0;&#x793A;</strong></p>
<blockquote>
<p>&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8BBE;&#x7F6E; <code>management.info.defaults.enabled</code> &#x5C5E;&#x6027;&#x6765;&#x7981;&#x7528;&#x5B83;&#x4EEC;&#x3002;</p>
</blockquote>
<p><a id="production-ready-application-info-env"></a></p>
<h4 id="5392&#x3001;&#x81EA;&#x5B9A;&#x4E49;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4FE1;&#x606F;">53.9.2&#x3001;&#x81EA;&#x5B9A;&#x4E49;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4FE1;&#x606F;</h4>
<p>&#x4F60;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8BBE;&#x7F6E; <code>info.*</code> &#x5B57;&#x7B26;&#x4E32;&#x5C5E;&#x6027;&#x6765;&#x81EA;&#x5B9A;&#x4E49; <code>info</code>&#x7AEF;&#x70B9;&#x66B4;&#x9732;&#x7684;&#x6570;&#x636E;&#x3002;<code>info</code> key &#x4E0B;&#x7684;&#x6240;&#x6709; <code>Environment</code> &#x5C5E;&#x6027;&#x90FD;&#x4F1A;&#x81EA;&#x52A8;&#x66B4;&#x9732;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x5C06;&#x4EE5;&#x4E0B;&#x8BBE;&#x7F6E;&#x6DFB;&#x52A0;&#x5230; <code>application.properties</code> &#x6587;&#x4EF6;&#x4E2D;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">info.app.encoding</span><span class="token attr-value"><span class="token punctuation">=</span>UTF-8</span>
<span class="token constant">info.app.java.source</span><span class="token attr-value"><span class="token punctuation">=</span>1.8</span>
<span class="token constant">info.app.java.target</span><span class="token attr-value"><span class="token punctuation">=</span>1.8</span>
</code></pre>
<p><strong>&#x63D0;&#x793A;</strong></p>
<blockquote>

&#x4F60;&#x53EF;&#x4EE5;&#x5728;[&#x6784;&#x5EFA;&#x65F6;&#x6269;&#x5C55; info &#x5C5E;&#x6027;](how-to.md#howto-automatic-expansion)&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x5BF9;&#x8FD9;&#x4E9B;&#x503C;&#x8FDB;&#x884C;&#x786C;&#x7F16;&#x7801;&#x3002;
&#x5047;&#x8BBE;&#x4F60;&#x4F7F;&#x7528; Maven&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x6309;&#x5982;&#x4E0B;&#x65B9;&#x5F0F;&#x91CD;&#x5199;&#x524D;&#x9762;&#x7684;&#x793A;&#x4F8B;&#xFF1A;

```ini
info.app.encoding=@project.build.sourceEncoding@
info.app.java.source=@java.version@
info.app.java.target=@java.version@
```

</blockquote>

<p><a id="production-ready-application-info-git"></a></p>
<h4 id="5393&#x3001;git-&#x63D0;&#x4EA4;&#x4FE1;&#x606F;">53.9.3&#x3001;Git &#x63D0;&#x4EA4;&#x4FE1;&#x606F;</h4>
<p><code>info</code> &#x7AEF;&#x70B9;&#x7684;&#x53E6;&#x4E00;&#x4E2A;&#x6709;&#x7528;&#x529F;&#x80FD;&#x662F;&#x5B83;&#x80FD;&#x591F;&#x5728;&#x6784;&#x5EFA;&#x9879;&#x76EE;&#x65F6;&#x53D1;&#x5E03; git &#x6E90;&#x7801;&#x4ED3;&#x5E93;&#x76F8;&#x5173;&#x7684;&#x72B6;&#x6001;&#x7684;&#x4FE1;&#x606F;&#x3002;&#x5982;&#x679C; <code>GitProperties</code> bean &#x53EF;&#x7528;&#xFF0C;&#x5219;&#x66B4;&#x9732; <code>git.branch</code>&#x3001;<code>git.commit.id</code> &#x548C; <code>git.commit.time</code> &#x5C5E;&#x6027;&#x3002;</p>
<p><strong>&#x63D0;&#x793A;</strong></p>
<blockquote>
<p>&#x5982;&#x679C; <code>git.properties</code> &#x6587;&#x4EF6;&#x5728; classpath &#x7684;&#x6839;&#x76EE;&#x5F55;&#x4E2D;&#x53EF;&#x7528;&#xFF0C;&#x5219;&#x4F1A;&#x81EA;&#x52A8;&#x914D;&#x7F6E; <code>GitProperties</code> bean&#x3002;&#x6709;&#x5173;&#x66F4;&#x591A;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#xFF0C;&#x8BF7;&#x53C2;&#x9605;<a href="how-to.md#howto-git-info"><strong>&#x751F;&#x6210; git &#x4FE1;&#x606F;</strong></a>&#x3002;</p>
</blockquote>
<p>&#x5982;&#x679C;&#x8981;&#x663E;&#x793A;&#x5B8C;&#x6574;&#x7684; git &#x4FE1;&#x606F;&#xFF08;&#x5373; <code>git.properties</code> &#x7684;&#x5B8C;&#x6574;&#x5185;&#x5BB9;&#xFF09;&#xFF0C;&#x8BF7;&#x4F7F;&#x7528; <code>management.info.git.mode</code> &#x5C5E;&#x6027;&#xFF0C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.info.git.mode</span><span class="token attr-value"><span class="token punctuation">=</span>full</span>
</code></pre>
<p><a id="production-ready-application-info-build"></a></p>
<h4 id="5394&#x3001;&#x6784;&#x5EFA;&#x4FE1;&#x606F;">53.9.4&#x3001;&#x6784;&#x5EFA;&#x4FE1;&#x606F;</h4>
<p>&#x5982;&#x679C; <code>BuildProperties</code> bean &#x53EF;&#x7528;&#xFF0C;&#x5219; <code>info</code> &#x7AEF;&#x70B9;&#x8FD8;&#x53EF;&#x4EE5;&#x53D1;&#x5E03;&#x6784;&#x5EFA;&#x76F8;&#x5173;&#x7684;&#x4FE1;&#x606F;&#x3002;&#x5982;&#x679C; classpath &#x4E2D;&#x6709; <code>META-INF/build-info.properties</code> &#x6587;&#x4EF6;&#xFF0C;&#x5219;&#x4F1A;&#x53D1;&#x751F;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x3002;</p>
<p><strong>&#x63D0;&#x793A;</strong></p>
<blockquote>
<p>Maven &#x548C; Gradle &#x63D2;&#x4EF6;&#x90FD;&#x53EF;&#x4EE5;&#x751F;&#x6210;&#x8BE5;&#x6587;&#x4EF6;&#x3002;&#x6709;&#x5173;&#x66F4;&#x591A;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#xFF0C;&#x8BF7;&#x53C2;&#x9605;<a href="how-to.md#howto-build-info"><strong>&#x751F;&#x6210;&#x6784;&#x5EFA;&#x4FE1;&#x606F;</strong></a>&#x3002;</p>
</blockquote>
<p><a id="production-ready-application-info-build"></a></p>
<h4 id="5395&#x3001;&#x7F16;&#x5199;&#x81EA;&#x5B9A;&#x4E49;-infocontributor">53.9.5&#x3001;&#x7F16;&#x5199;&#x81EA;&#x5B9A;&#x4E49; InfoContributor</h4>
<p>&#x8981;&#x63D0;&#x4F9B;&#x81EA;&#x5B9A;&#x4E49;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4FE1;&#x606F;&#xFF0C;&#x53EF;&#x4EE5;&#x6CE8;&#x518C;&#x5B9E;&#x73B0; <a href="https://github.com/spring-projects/spring-boot/tree/v2.1.3.RELEASE/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/InfoContributor.java" target="_blank"><code>InfoContributor</code></a> &#x63A5;&#x53E3;&#x7684; Spring bean&#x3002;</p>
<p>&#x4EE5;&#x4E0B;&#x793A;&#x4F8B;&#x63D0;&#x4F9B;&#x4E86;&#x5177;&#x6709;&#x5355;&#x4E2A;&#x503C;&#x7684; <code>example</code> &#x6761;&#x76EE;&#xFF1A;</p>
<pre class="language-"><code class="lang-java"><span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>util</span><span class="token punctuation">.</span><span class="token class-name">Collections</span><span class="token punctuation">;</span>

<span class="token keyword">import</span> <span class="token namespace">org<span class="token punctuation">.</span>springframework<span class="token punctuation">.</span>boot<span class="token punctuation">.</span>actuate<span class="token punctuation">.</span>info</span><span class="token punctuation">.</span><span class="token class-name">Info</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token namespace">org<span class="token punctuation">.</span>springframework<span class="token punctuation">.</span>boot<span class="token punctuation">.</span>actuate<span class="token punctuation">.</span>info</span><span class="token punctuation">.</span><span class="token class-name">InfoContributor</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token namespace">org<span class="token punctuation">.</span>springframework<span class="token punctuation">.</span>stereotype</span><span class="token punctuation">.</span><span class="token class-name">Component</span><span class="token punctuation">;</span>

<span class="token annotation punctuation">@Component</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">ExampleInfoContributor</span> <span class="token keyword">implements</span> <span class="token class-name">InfoContributor</span> <span class="token punctuation">{</span>

    <span class="token annotation punctuation">@Override</span>
    <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">contribute</span><span class="token punctuation">(</span><span class="token class-name">Info</span><span class="token punctuation">.</span><span class="token class-name">Builder</span> builder<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        builder<span class="token punctuation">.</span><span class="token function">withDetail</span><span class="token punctuation">(</span><span class="token string">&quot;example&quot;</span><span class="token punctuation">,</span>
                <span class="token class-name">Collections</span><span class="token punctuation">.</span><span class="token function">singletonMap</span><span class="token punctuation">(</span><span class="token string">&quot;key&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;value&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

<span class="token punctuation">}</span>
</code></pre>
<p>&#x5982;&#x679C;&#x8BBF;&#x95EE; <code>info</code> &#x7AEF;&#x70B9;&#xFF0C;&#x4F60;&#x5E94;&#x8BE5;&#x80FD;&#x770B;&#x5230;&#x5305;&#x542B;&#x4EE5;&#x4E0B;&#x9644;&#x52A0;&#x6761;&#x76EE;&#x7684;&#x54CD;&#x5E94;&#xFF1A;</p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
    <span class="token property">&quot;example&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
        <span class="token property">&quot;key&quot;</span> <span class="token operator">:</span> <span class="token string">&quot;value&quot;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p><a id="production-ready-monitoring"></a></p>
<h2 id="54&#x3001;&#x901A;&#x8FC7;-http-&#x76D1;&#x63A7;&#x548C;&#x7BA1;&#x7406;">54&#x3001;&#x901A;&#x8FC7; HTTP &#x76D1;&#x63A7;&#x548C;&#x7BA1;&#x7406;</h2>
<p>&#x5982;&#x679C;&#x4F60;&#x6B63;&#x5728;&#x5F00;&#x53D1; Web &#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#xFF0C;Spring Boot Actuator &#x4F1A;&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x6240;&#x6709;&#x5DF2;&#x542F;&#x7528;&#x7684;&#x7AEF;&#x70B9;&#x4EE5;&#x901A;&#x8FC7; HTTP &#x66B4;&#x9732;&#x3002;&#x9ED8;&#x8BA4;&#x7EA6;&#x5B9A;&#x662F;&#x4F7F;&#x7528;&#x524D;&#x7F00;&#x4E3A; <code>/actuator</code> &#x7684;&#x7AEF;&#x70B9;&#x7684; <code>id</code> &#x4F5C;&#x4E3A; URL &#x8DEF;&#x5F84;&#x3002;&#x4F8B;&#x5982;&#xFF0C;<code>health</code> &#x4EE5; <code>/actuator/health</code> &#x66B4;&#x9732;&#x3002;&#x63D0;&#x793A;&#xFF1A;Spring MVC&#x3001;Spring WebFlux &#x548C; Jersey &#x672C;&#x8EAB;&#x652F;&#x6301; Actuator&#x3002;</p>
<p><a id="production-ready-customizing-management-server-context-path"></a></p>
<h3 id="541&#x3001;&#x81EA;&#x5B9A;&#x4E49;-management-&#x7AEF;&#x70B9;&#x8DEF;&#x5F84;">54.1&#x3001;&#x81EA;&#x5B9A;&#x4E49; Management &#x7AEF;&#x70B9;&#x8DEF;&#x5F84;</h3>
<p>&#x6709;&#x65F6;&#xFF0C;&#x81EA;&#x5B9A;&#x4E49; management &#x7AEF;&#x70B9;&#x7684;&#x524D;&#x7F00;&#x5F88;&#x6709;&#x7528;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x4F60;&#x7684;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x53EF;&#x80FD;&#x5DF2;&#x5C06; <code>/actuator</code> &#x7528;&#x4E8E;&#x5176;&#x4ED6;&#x76EE;&#x7684;&#x3002;&#x4F60;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>management.endpoints.web.base-path</code> &#x5C5E;&#x6027;&#x66F4;&#x6539; management &#x7AEF;&#x70B9;&#x7684;&#x524D;&#x7F00;&#xFF0C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.endpoints.web.base-path</span><span class="token attr-value"><span class="token punctuation">=</span>/manage</span>
</code></pre>
<p>&#x524D;&#x9762;&#x7684; <code>application.properties</code> &#x793A;&#x4F8B;&#x5C06;&#x7AEF;&#x70B9;&#x4ECE; <code>/actuator/{id}</code> &#x66F4;&#x6539;&#x4E3A; <code>/manage/{id}</code>&#xFF08;&#x4F8B;&#x5982;&#xFF0C;<code>/manage/info</code>&#xFF09;&#x3002;</p>
<p><strong>&#x6CE8;&#x610F;</strong></p>
<blockquote>
<p>&#x9664;&#x975E;&#x5DF2;&#x5C06; management &#x7AEF;&#x53E3;&#x914D;&#x7F6E;&#x4E3A;<a href="production-ready-customizing-management-server-port">&#x4F7F;&#x7528;&#x5176;&#x4ED6; HTTP &#x7AEF;&#x53E3;&#x66B4;&#x9732;&#x7AEF;&#x70B9;</a>&#xFF0C;&#x5426;&#x5219; <code>management.endpoints.web.base-path</code> &#x4E0E; <code>server.servlet.context-path</code> &#x76F8;&#x5173;&#x8054;&#x3002;&#x5982;&#x679C;&#x914D;&#x7F6E;&#x4E86; <code>management.server.port</code>&#xFF0C;&#x5219; <code>management.endpoints.web.base-path</code> &#x4E0E; <code>management.server.servlet.context-path</code> &#x76F8;&#x5173;&#x8054;&#x3002;</p>
</blockquote>
<p>&#x5982;&#x679C;&#x8981;&#x5C06;&#x7AEF;&#x70B9;&#x6620;&#x5C04;&#x5230;&#x5176;&#x4ED6;&#x8DEF;&#x5F84;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>management.endpoints.web.path-mapping</code> &#x5C5E;&#x6027;&#x3002;</p>
<p>&#x4EE5;&#x4E0B;&#x793A;&#x4F8B;&#x5C06; <code>/actuator/health</code> &#x91CD;&#x65B0;&#x6620;&#x5C04;&#x5230; <code>/healthcheck</code>&#xFF1A;</p>
<p><strong>application.properties</strong></p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.endpoints.web.base-path</span><span class="token attr-value"><span class="token punctuation">=</span>/</span>
<span class="token constant">management.endpoints.web.path-mapping.health</span><span class="token attr-value"><span class="token punctuation">=</span>healthcheck</span>
</code></pre>
<p><a id="production-ready-customizing-management-server-port"></a></p>
<h3 id="542&#x3001;&#x81EA;&#x5B9A;&#x4E49;-management-&#x670D;&#x52A1;&#x5668;&#x7AEF;&#x53E3;">54.2&#x3001;&#x81EA;&#x5B9A;&#x4E49; Management &#x670D;&#x52A1;&#x5668;&#x7AEF;&#x53E3;</h3>
<p>&#x4F7F;&#x7528;&#x9ED8;&#x8BA4; HTTP &#x7AEF;&#x53E3;&#x66B4;&#x9732; management &#x7AEF;&#x70B9;&#x662F;&#x57FA;&#x4E8E;&#x4E91;&#x90E8;&#x7F72;&#x7684;&#x660E;&#x667A;&#x9009;&#x62E9;&#x3002;&#x4F46;&#x662F;&#xFF0C;&#x5982;&#x679C;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x662F;&#x5728;&#x81EA;&#x5DF1;&#x7684;&#x6570;&#x636E;&#x4E2D;&#x5FC3;&#x5185;&#x8FD0;&#x884C;&#xFF0C;&#x4F60;&#x53EF;&#x80FD;&#x66F4;&#x559C;&#x6B22;&#x4F7F;&#x7528;&#x5176;&#x4ED6; HTTP &#x7AEF;&#x53E3;&#x66B4;&#x9732;&#x7AEF;&#x70B9;&#x3002;</p>
<p>&#x4F60;&#x53EF;&#x4EE5;&#x8BBE;&#x7F6E; <code>management.server.port</code> &#x5C5E;&#x6027;&#x4EE5;&#x66F4;&#x6539; HTTP &#x7AEF;&#x53E3;&#xFF0C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.server.port</span><span class="token attr-value"><span class="token punctuation">=</span>8081</span>
</code></pre>
<p><a id="production-ready-management-specific-ssl"></a></p>
<h3 id="543&#x3001;&#x914D;&#x7F6E;-management-&#x7684;-ssl">54.3&#x3001;&#x914D;&#x7F6E; Management &#x7684; SSL</h3>
<p>&#x5F53;&#x914D;&#x7F6E;&#x4E3A;&#x4F7F;&#x7528;&#x81EA;&#x5B9A;&#x4E49;&#x7AEF;&#x53E3;&#x65F6;&#xFF0C;&#x8FD8;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x5404;&#x79CD; <code>management.server.ssl.*</code> &#x5C5E;&#x6027;&#x4E3A; management &#x670D;&#x52A1;&#x5668;&#x914D;&#x7F6E;&#x81EA;&#x5DF1;&#x7684; SSL&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x8FD9;&#x6837;&#x505A;&#x53EF;&#x4EE5;&#x5728;&#x4E3B;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4F7F;&#x7528; HTTPS &#x65F6;&#x53EF;&#x901A;&#x8FC7; HTTP &#x4F7F;&#x7528; management &#x670D;&#x52A1;&#x5668;&#xFF0C;&#x5982;&#x4EE5;&#x4E0B;&#x5C5E;&#x6027;&#x8BBE;&#x7F6E;&#x6240;&#x793A;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">server.port</span><span class="token attr-value"><span class="token punctuation">=</span>8443</span>
<span class="token constant">server.ssl.enabled</span><span class="token attr-value"><span class="token punctuation">=</span>true</span>
<span class="token constant">server.ssl.key-store</span><span class="token attr-value"><span class="token punctuation">=</span>classpath:store.jks</span>
<span class="token constant">server.ssl.key-password</span><span class="token attr-value"><span class="token punctuation">=</span>secret</span>
<span class="token constant">management.server.port</span><span class="token attr-value"><span class="token punctuation">=</span>8080</span>
<span class="token constant">management.server.ssl.enabled</span><span class="token attr-value"><span class="token punctuation">=</span>false</span>
</code></pre>
<p>&#x6216;&#x8005;&#xFF0C;&#x4E3B;&#x670D;&#x52A1;&#x5668;&#x548C; management &#x670D;&#x52A1;&#x5668;&#x90FD;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; SSL&#xFF0C;&#x4F46;&#x4ED6;&#x4EEC;&#x7684; key store &#x4E0D;&#x540C;&#xFF0C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">server.port</span><span class="token attr-value"><span class="token punctuation">=</span>8443</span>
<span class="token constant">server.ssl.enabled</span><span class="token attr-value"><span class="token punctuation">=</span>true</span>
<span class="token constant">server.ssl.key-store</span><span class="token attr-value"><span class="token punctuation">=</span>classpath:main.jks</span>
<span class="token constant">server.ssl.key-password</span><span class="token attr-value"><span class="token punctuation">=</span>secret</span>
<span class="token constant">management.server.port</span><span class="token attr-value"><span class="token punctuation">=</span>8080</span>
<span class="token constant">management.server.ssl.enabled</span><span class="token attr-value"><span class="token punctuation">=</span>true</span>
<span class="token constant">management.server.ssl.key-store</span><span class="token attr-value"><span class="token punctuation">=</span>classpath:management.jks</span>
<span class="token constant">management.server.ssl.key-password</span><span class="token attr-value"><span class="token punctuation">=</span>secret</span>
</code></pre>
<p><a id="production-ready-customizing-management-server-address"></a></p>
<h3 id="544&#x3001;&#x914D;&#x7F6E;-management-&#x670D;&#x52A1;&#x5668;&#x5730;&#x5740;">54.4&#x3001;&#x914D;&#x7F6E; Management &#x670D;&#x52A1;&#x5668;&#x5730;&#x5740;</h3>
<p>&#x4F60;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8BBE;&#x7F6E; <code>management.server.address</code> &#x5C5E;&#x6027;&#x6765;&#x81EA;&#x5B9A;&#x4E49; management &#x7AEF;&#x70B9;&#x53EF;&#x7528;&#x7684;&#x5730;&#x5740;&#x3002;&#x5982;&#x679C;&#x4F60;&#x53EA;&#x60F3;&#x5728;&#x5185;&#x90E8;&#x6216;&#x64CD;&#x4F5C;&#x7684;&#x7F51;&#x7EDC;&#x4E0A;&#x76D1;&#x542C;&#x6216;&#x4EC5;&#x76D1;&#x542C;&#x6765;&#x81EA; <code>localhost</code> &#x7684;&#x8FDE;&#x63A5;&#xFF0C;&#x90A3;&#x4E48;&#x8FD9;&#x6837;&#x505A;&#x4F1A;&#x975E;&#x5E38;&#x6709;&#x7528;&#x3002;</p>
<p><strong>&#x6CE8;&#x610F;</strong></p>
<blockquote>
<p>&#x4EC5;&#x5F53;&#x7AEF;&#x53E3;&#x4E0E;&#x4E3B;&#x670D;&#x52A1;&#x5668;&#x7AEF;&#x53E3;&#x4E0D;&#x540C;&#x65F6;&#xFF0C;&#x624D;&#x80FD;&#x76D1;&#x542C;&#x4E0D;&#x540C;&#x7684;&#x5730;&#x5740;&#x3002;</p>
</blockquote>
<p>&#x4EE5;&#x4E0B; <code>application.properties</code> &#x793A;&#x4F8B;&#x4E0D;&#x5141;&#x8BB8;&#x8FDC;&#x7A0B;&#x8FDE;&#x63A5; management&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.server.port</span><span class="token attr-value"><span class="token punctuation">=</span>8081</span>
<span class="token constant">management.server.address</span><span class="token attr-value"><span class="token punctuation">=</span>127.0.0.1</span>
</code></pre>
<p><a id="production-ready-disabling-http-endpoints"></a></p>
<h3 id="545&#x3001;&#x7981;&#x7528;-http-&#x7AEF;&#x70B9;">54.5&#x3001;&#x7981;&#x7528; HTTP &#x7AEF;&#x70B9;</h3>
<p>&#x5982;&#x679C;&#x4F60;&#x4E0D;&#x5E0C;&#x671B;&#x901A;&#x8FC7; HTTP &#x66B4;&#x9732;&#x7AEF;&#x70B9;&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x5C06; management &#x7AEF;&#x53E3;&#x8BBE;&#x7F6E;&#x4E3A; <code>-1</code>&#xFF0C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.server.port</span><span class="token attr-value"><span class="token punctuation">=</span>-1</span>
</code></pre>
<p>&#x8FD9;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>management.endpoints.web.exposure.exclude</code> &#x5C5E;&#x6027;&#x6765;&#x5B9E;&#x73B0;&#xFF0C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.endpoints.web.exposure.exclude</span><span class="token attr-value"><span class="token punctuation">=</span>*</span>
</code></pre>
<p><a id="production-ready-jmx"></a></p>
<h2 id="55&#x3001;&#x901A;&#x8FC7;-jmx-&#x76D1;&#x63A7;&#x548C;&#x7BA1;&#x7406;">55&#x3001;&#x901A;&#x8FC7; JMX &#x76D1;&#x63A7;&#x548C;&#x7BA1;&#x7406;</h2>
<p>Java &#x7BA1;&#x7406;&#x6269;&#x5C55;&#xFF08;Java Management Extensions&#xFF0C;JMX&#xFF09;&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x79CD;&#x76D1;&#x63A7;&#x548C;&#x7BA1;&#x7406;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x7684;&#x6807;&#x51C6;&#x673A;&#x5236;&#x3002;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;Spring Boot &#x5C06; management &#x7AEF;&#x70B9;&#x66B4;&#x9732;&#x4E3A; <code>org.springframework.boot</code> &#x57DF;&#x4E0B;&#x7684; JMX MBean&#x3002;</p>
<p><a id="production-ready-custom-mbean-names"></a></p>
<h3 id="551&#x3001;&#x81EA;&#x5B9A;&#x4E49;-mbean-&#x540D;&#x79F0;">55.1&#x3001;&#x81EA;&#x5B9A;&#x4E49; MBean &#x540D;&#x79F0;</h3>
<p>MBean &#x7684;&#x540D;&#x79F0;&#x901A;&#x5E38;&#x662F;&#x4ECE;&#x7AEF;&#x70B9;&#x7684; <code>id</code> &#x751F;&#x6210;&#x7684;&#x3002;&#x4F8B;&#x5982;&#xFF0C;<code>health</code> &#x7AEF;&#x70B9;&#x516C;&#x5F00;&#x4E3A; <code>org.springframework.boot:type=Endpoint,name=Health</code>&#x3002;</p>
<p>&#x5982;&#x679C;&#x4F60;&#x7684;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x5305;&#x542B;&#x591A;&#x4E2A; Spring <code>ApplicationContext</code>&#xFF0C;&#x53EF;&#x80FD;&#x4F1A;&#x53D1;&#x751F;&#x540D;&#x79F0;&#x51B2;&#x7A81;&#x3002;&#x8981;&#x89E3;&#x51B3;&#x6B64;&#x95EE;&#x9898;&#xFF0C;&#x53EF;&#x4EE5;&#x5C06; <code>spring.jmx.unique-names</code> &#x5C5E;&#x6027;&#x8BBE;&#x7F6E;&#x4E3A; <code>true</code>&#xFF0C;&#x4EE5;&#x4FDD;&#x8BC1; MBean &#x540D;&#x79F0;&#x59CB;&#x7EC8;&#x552F;&#x4E00;&#x3002;</p>
<p>&#x4F60;&#x8FD8;&#x53EF;&#x4EE5;&#x81EA;&#x5B9A;&#x4E49;&#x66B4;&#x9732;&#x7AEF;&#x70B9;&#x7684; JMX &#x57DF;&#x3002;&#x4EE5;&#x4E0B;&#x8BBE;&#x7F6E;&#x5C55;&#x793A;&#x4E86;&#x5728; <code>application.properties</code> &#x4E2D;&#x6267;&#x884C;&#x6B64;&#x64CD;&#x4F5C;&#x7684;&#x793A;&#x4F8B;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">spring.jmx.unique-names</span><span class="token attr-value"><span class="token punctuation">=</span>true</span>
<span class="token constant">management.endpoints.jmx.domain</span><span class="token attr-value"><span class="token punctuation">=</span>com.example.myapp</span>
</code></pre>
<p><a id="production-ready-disable-jmx-endpoints"></a></p>
<h3 id="552&#x3001;&#x7981;&#x7528;-jmx-&#x7AEF;&#x70B9;">55.2&#x3001;&#x7981;&#x7528; JMX &#x7AEF;&#x70B9;</h3>
<p>&#x5982;&#x679C;&#x4F60;&#x4E0D;&#x60F3;&#x901A;&#x8FC7; JMX &#x66B4;&#x9732;&#x7AEF;&#x70B9;&#xFF0C;&#x53EF;&#x4EE5;&#x5C06; <code>management.endpoints.jmx.exposure.exclude</code> &#x5C5E;&#x6027;&#x8BBE;&#x7F6E;&#x4E3A; <code>*</code>&#xFF0C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.endpoints.jmx.exposure.exclude</span><span class="token attr-value"><span class="token punctuation">=</span>*</span>
</code></pre>
<p><a id="production-ready-jolokia"></a></p>
<h3 id="553&#x3001;&#x901A;&#x8FC7;-http-&#x4F7F;&#x7528;-jolokia-&#x8BBF;&#x95EE;-jmx">55.3&#x3001;&#x901A;&#x8FC7; HTTP &#x4F7F;&#x7528; Jolokia &#x8BBF;&#x95EE; JMX</h3>
<p>Jolokia &#x662F;&#x4E00;&#x4E2A; JMX-HTTP &#x6865;&#xFF0C;&#x5B83;&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x79CD;&#x8BBF;&#x95EE; JMX bean &#x7684;&#x65B0;&#x65B9;&#x5F0F;&#x3002;&#x8981;&#x4F7F;&#x7528; Jolokia&#xFF0C;&#x8BF7;&#x5F15;&#x5165;&#x4F9D;&#x8D56;&#xFF1A;<code>org.jolokia:jolokia-core</code>&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x4F7F;&#x7528; Maven&#xFF0C;&#x4F60;&#x5C06;&#x6DFB;&#x52A0;&#x4EE5;&#x4E0B;&#x4F9D;&#x8D56;&#xFF1A;</p>
<pre class="language-"><code class="lang-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dependency</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>groupId</span><span class="token punctuation">&gt;</span></span>org.jolokia<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>groupId</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>artifactId</span><span class="token punctuation">&gt;</span></span>jolokia-core<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>artifactId</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dependency</span><span class="token punctuation">&gt;</span></span>
</code></pre>
<p>&#x4E4B;&#x540E;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x5C06; <code>jolokia</code> &#x6216; <code>*</code> &#x6DFB;&#x52A0;&#x5230; <code>management.endpoints.web.exposure.include</code> &#x5C5E;&#x6027;&#x6765;&#x66B4;&#x9732; Jolokia &#x7AEF;&#x70B9;&#x3002;&#x6700;&#x540E;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x5728; management HTTP &#x670D;&#x52A1;&#x5668;&#x4E0A;&#x4F7F;&#x7528; <code>/actuator/jolokia</code> &#x8BBF;&#x95EE;&#x5B83;&#x3002;</p>
<p><a id="production-ready-customizing-jolokia"></a></p>
<h4 id="5531&#x3001;&#x81EA;&#x5B9A;&#x4E49;-jolokia">55.3.1&#x3001;&#x81EA;&#x5B9A;&#x4E49; Jolokia</h4>
<p>Jolokia &#x6709;&#x8BB8;&#x591A;&#x8BBE;&#x7F6E;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8BBE;&#x7F6E; servlet &#x53C2;&#x6570;&#x6765;&#x4F7F;&#x7528;&#x4F20;&#x7EDF;&#x65B9;&#x5F0F;&#x8FDB;&#x884C;&#x914D;&#x7F6E;&#x3002;&#x4F7F;&#x7528; Spring Boot &#x65F6;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>application.properties</code> &#x6587;&#x4EF6;&#x914D;&#x7F6E;&#x3002;&#x8BF7;&#x5728;&#x53C2;&#x6570;&#x524D;&#x52A0;&#x4E0A; <code>management.endpoint.jolokia.config</code>&#x3002;&#x5982;&#x4E0B;&#x6240;&#x793A;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.endpoint.jolokia.config.debug</span><span class="token attr-value"><span class="token punctuation">=</span>true</span>
</code></pre>
<p><a id="production-ready-disabling-jolokia"></a></p>
<h4 id="5532&#x3001;&#x7981;&#x7528;-jolokia">55.3.2&#x3001;&#x7981;&#x7528; Jolokia</h4>
<p>&#x5982;&#x679C;&#x4F60;&#x4F7F;&#x7528; Jolokia &#x4F46;&#x4E0D;&#x5E0C;&#x671B; Spring Boot &#x914D;&#x7F6E;&#x5B83;&#xFF0C;&#x8BF7;&#x5C06; <code>management.endpoint.jolokia.enabled</code> &#x5C5E;&#x6027;&#x8BBE;&#x7F6E;&#x4E3A; <code>false</code>&#xFF0C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.endpoint.jolokia.enabled</span><span class="token attr-value"><span class="token punctuation">=</span>false</span>
</code></pre>
<p><a id="production-ready-loggers"></a></p>
<h2 id="56&#x3001;&#x65E5;&#x5FD7;&#x8BB0;&#x5F55;&#x5668;">56&#x3001;&#x65E5;&#x5FD7;&#x8BB0;&#x5F55;&#x5668;</h2>
<p>Spring Boot Actuator &#x6709;&#x53EF;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x67E5;&#x770B;&#x548C;&#x914D;&#x7F6E;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x65E5;&#x5FD7;&#x7EA7;&#x522B;&#x7684;&#x529F;&#x80FD;&#x3002;&#x4F60;&#x53EF;&#x4EE5;&#x67E5;&#x770B;&#x5168;&#x90E8;&#x6216;&#x5355;&#x4E2A;&#x65E5;&#x5FD7;&#x8BB0;&#x5F55;&#x5668;&#x7684;&#x914D;&#x7F6E;&#xFF0C;&#x8BE5;&#x914D;&#x7F6E;&#x7531;&#x663E;&#x5F0F;&#x914D;&#x7F6E;&#x7684;&#x65E5;&#x5FD7;&#x8BB0;&#x5F55;&#x7EA7;&#x522B;&#x4EE5;&#x53CA;&#x65E5;&#x5FD7;&#x8BB0;&#x5F55;&#x6846;&#x67B6;&#x4E3A;&#x5176;&#x63D0;&#x4F9B;&#x7684;&#x6709;&#x6548;&#x65E5;&#x5FD7;&#x8BB0;&#x5F55;&#x7EA7;&#x522B;&#x7EC4;&#x6210;&#x3002;&#x8FD9;&#x4E9B;&#x7EA7;&#x522B;&#x53EF;&#x4EE5;&#x662F;&#x4EE5;&#x4E0B;&#x4E4B;&#x4E00;&#xFF1A;</p>
<ul>
<li><code>TRACE</code></li>
<li><code>DEBUG</code></li>
<li><code>INFO</code></li>
<li><code>WARN</code></li>
<li><code>ERROR</code></li>
<li><code>FATAL</code></li>
<li><code>OFF</code></li>
<li><code>null</code></li>
</ul>
<p><code>null</code> &#x8868;&#x793A;&#x6CA1;&#x6709;&#x663E;&#x5F0F;&#x914D;&#x7F6E;&#x3002;</p>
<p><a id="production-ready-logger-configuration"></a></p>
<h3 id="561&#x3001;&#x914D;&#x7F6E;&#x4E00;&#x4E2A;&#x65E5;&#x5FD7;&#x8BB0;&#x5F55;&#x5668;">56.1&#x3001;&#x914D;&#x7F6E;&#x4E00;&#x4E2A;&#x65E5;&#x5FD7;&#x8BB0;&#x5F55;&#x5668;</h3>
<p>&#x8981;&#x914D;&#x7F6E;&#x65E5;&#x5FD7;&#x8BB0;&#x5F55;&#x5668;&#xFF0C;&#x8BF7;&#x5C06;&#x90E8;&#x5206;&#x5B9E;&#x4F53; <code>POST</code> &#x5230;&#x8D44;&#x6E90;&#x7684; URI&#xFF0C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#xFF1A;</p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
    <span class="token property">&quot;configuredLevel&quot;</span><span class="token operator">:</span> <span class="token string">&quot;DEBUG&quot;</span>
<span class="token punctuation">}</span>
</code></pre>
<p><strong>&#x63D0;&#x793A;</strong></p>
<blockquote>
<p>&#x8981;<strong>&#x91CD;&#x7F6E;</strong>&#x65E5;&#x5FD7;&#x8BB0;&#x5F55;&#x5668;&#x7684;&#x7279;&#x5B9A;&#x7EA7;&#x522B;&#xFF08;&#x5E76;&#x4F7F;&#x7528;&#x9ED8;&#x8BA4;&#x914D;&#x7F6E;&#x4EE3;&#x66FF;&#xFF09;&#xFF0C;&#x53EF;&#x4EE5;&#x5C06; <code>null</code> &#x503C;&#x4F5C;&#x4E3A; <code>configuredLevel</code> &#x4F20;&#x9012;&#x3002;</p>
</blockquote>
<p><a id="production-ready-metrics"></a></p>
<h2 id="57&#x3001;&#x6307;&#x6807;">57&#x3001;&#x6307;&#x6807;</h2>
<p>Spring Boot Actuator &#x4E3A; <a href="https://micrometer.io/" target="_blank">Micrometer</a> &#x63D0;&#x4F9B;&#x4E86;&#x4F9D;&#x8D56;&#x7BA1;&#x7406;&#x548C;&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#xFF0C;Micrometer &#x662F;&#x4E00;&#x4E2A;&#x652F;&#x6301;&#x4F17;&#x591A;&#x76D1;&#x63A7;&#x7CFB;&#x7EDF;&#x7684;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x6307;&#x6807;&#x95E8;&#x9762;&#xFF0C;&#x5305;&#x62EC;&#xFF1A;</p>
<ul>
<li><a href="#production-ready-metrics-export-appoptics">AppOptics</a></li>
<li><a href="#production-ready-metrics-export-atlas">Atlas</a></li>
<li><a href="#production-ready-metrics-export-datadog">Datadog</a></li>
<li><a href="#production-ready-metrics-export-dynatrace">Dynatrace</a></li>
<li><a href="#production-ready-metrics-export-elastic">Elastic</a></li>
<li><a href="#production-ready-metrics-export-ganglia">Ganglia</a></li>
<li><a href="#production-ready-metrics-export-graphite">Graphite</a></li>
<li><a href="#production-ready-metrics-export-humio">Humio</a></li>
<li><a href="#production-ready-metrics-export-influx">Influx</a></li>
<li><a href="#production-ready-metrics-export-jmx">JMX</a></li>
<li><a href="#production-ready-metrics-export-kairos">KairosDB</a></li>
<li><a href="#production-ready-metrics-export-newrelic">New Relic</a></li>
<li><a href="#production-ready-metrics-export-prometheus">Prometheus</a></li>
<li><a href="#production-ready-metrics-export-signalfx">SignalFx</a></li>
<li><a href="#production-ready-metrics-export-simple">Simple (in-memory)</a></li>
<li><a href="#production-ready-metrics-export-statsd">StatsD</a></li>
<li><a href="#production-ready-metrics-export-wavefront">Wavefront</a></li>
</ul>
<p><strong>&#x63D0;&#x793A;</strong></p>
<p>&#x8981;&#x4E86;&#x89E3;&#x6709;&#x5173; Micrometer &#x529F;&#x80FD;&#x7684;&#x66F4;&#x591A;&#x4FE1;&#x606F;&#xFF0C;&#x8BF7;&#x53C2;&#x9605;&#x5176;<a href="https://micrometer.io/docs" target="_blank">&#x53C2;&#x8003;&#x6587;&#x6863;</a>&#xFF0C;&#x7279;&#x522B;&#x662F;<a href="https://micrometer.io/docs/concepts" target="_blank">&#x6982;&#x5FF5;&#x90E8;&#x5206;</a>&#x3002;</p>
<p><a id="production-ready-metrics-getting-started"></a></p>
<h3 id="571&#x3001;&#x5165;&#x95E8;">57.1&#x3001;&#x5165;&#x95E8;</h3>
<p>Spring Boot &#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x4E86;&#x4E00;&#x4E2A;&#x7EC4;&#x5408;&#x7684; <code>MeterRegistry</code>&#xFF0C;&#x5E76;&#x4E3A; classpath &#x4E2D;&#x6BCF;&#x4E2A;&#x53D7;&#x652F;&#x6301;&#x7684;&#x5B9E;&#x73B0;&#x5411;&#x8BE5;&#x7EC4;&#x5408;&#x6CE8;&#x518C;&#x4E00;&#x4E2A;&#x6CE8;&#x518C;&#x8868;&#x3002;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#xFF0C;&#x53EA;&#x9700;&#x8981; classpath &#x4E2D;&#x6709; <code>micrometer-registry-{system}</code> &#x4F9D;&#x8D56;&#x5373;&#x53EF;&#x8BA9; Spring Boot &#x914D;&#x7F6E;&#x8BE5;&#x6CE8;&#x518C;&#x8868;&#x3002;</p>
<p>&#x5927;&#x90E8;&#x5206;&#x6CE8;&#x518C;&#x8868;&#x90FD;&#x6709;&#x5171;&#x540C;&#x70B9; &#x4F8B;&#x5982;&#xFF0C;&#x5373;&#x4F7F; Micrometer &#x6CE8;&#x518C;&#x5B9E;&#x73B0;&#x4F4D;&#x4E8E; classpath &#x4E0A;&#xFF0C;&#x4F60;&#x4E5F;&#x53EF;&#x4EE5;&#x7981;&#x7528;&#x7279;&#x5B9A;&#x7684;&#x6CE8;&#x518C;&#x8868;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x8981;&#x7981;&#x7528; Datadog&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.datadog.enabled</span><span class="token attr-value"><span class="token punctuation">=</span>false</span>
</code></pre>
<p>Spring Boot &#x8FD8;&#x4F1A;&#x5C06;&#x6240;&#x6709;&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x7684;&#x6CE8;&#x518C;&#x8868;&#x6DFB;&#x52A0;&#x5230; <code>Metrics</code> &#x7C7B;&#x7684;&#x5168;&#x5C40;&#x9759;&#x6001;&#x590D;&#x5408;&#x6CE8;&#x518C;&#x8868;&#x4E2D;&#xFF0C;&#x9664;&#x975E;&#x4F60;&#x660E;&#x786E;&#x7981;&#x6B62;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.use-global-registry</span><span class="token attr-value"><span class="token punctuation">=</span>false</span>
</code></pre>
<p>&#x5728;&#x6CE8;&#x518C;&#x8868;&#x4E2D;&#x6CE8;&#x518C;&#x4EFB;&#x4F55;&#x6307;&#x6807;&#x4E4B;&#x524D;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x6CE8;&#x518C;&#x4EFB;&#x610F;&#x6570;&#x91CF;&#x7684; <code>MeterRegistryCustomizer</code> bean &#x4EE5;&#x8FDB;&#x4E00;&#x6B65;&#x914D;&#x7F6E;&#x6CE8;&#x518C;&#x8868;&#xFF0C;&#x4F8B;&#x5982;&#x901A;&#x7528;&#x6807;&#x7B7E;&#xFF1A;</p>
<pre class="language-"><code class="lang-java"><span class="token annotation punctuation">@Bean</span>
<span class="token class-name">MeterRegistryCustomizer</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">MeterRegistry</span><span class="token punctuation">&gt;</span></span> <span class="token function">metricsCommonTags</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> registry <span class="token operator">-&gt;</span> registry<span class="token punctuation">.</span><span class="token function">config</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">commonTags</span><span class="token punctuation">(</span><span class="token string">&quot;region&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;us-east-1&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x4F60;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x6307;&#x5B9A;&#x6CDB;&#x578B;&#x7C7B;&#x578B;&#xFF0C;&#x81EA;&#x5B9A;&#x4E49;&#x6CE8;&#x518C;&#x8868;&#x5B9E;&#x73B0;&#xFF1A;</p>
<pre class="language-"><code class="lang-java"><span class="token annotation punctuation">@Bean</span>
<span class="token class-name">MeterRegistryCustomizer</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">GraphiteMeterRegistry</span><span class="token punctuation">&gt;</span></span> <span class="token function">graphiteMetricsNamingConvention</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> registry <span class="token operator">-&gt;</span> registry<span class="token punctuation">.</span><span class="token function">config</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">namingConvention</span><span class="token punctuation">(</span>MY_CUSTOM_CONVENTION<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x4F7F;&#x7528;&#x8BE5;&#x8BBE;&#x7F6E;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x5728;&#x7EC4;&#x4EF6;&#x4E2D;&#x6CE8;&#x5165; <code>MeterRegistry</code> &#x5E76;&#x6CE8;&#x518C;&#x6307;&#x6807;&#xFF1A;</p>
<pre class="language-"><code class="lang-java"><span class="token annotation punctuation">@Component</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">SampleBean</span> <span class="token punctuation">{</span>

    <span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">Counter</span> counter<span class="token punctuation">;</span>

    <span class="token keyword">public</span> <span class="token class-name">SampleBean</span><span class="token punctuation">(</span><span class="token class-name">MeterRegistry</span> registry<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">this</span><span class="token punctuation">.</span>counter <span class="token operator">=</span> registry<span class="token punctuation">.</span><span class="token function">counter</span><span class="token punctuation">(</span><span class="token string">&quot;received.messages&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">handleMessage</span><span class="token punctuation">(</span><span class="token class-name">String</span> message<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">this</span><span class="token punctuation">.</span>counter<span class="token punctuation">.</span><span class="token function">increment</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token comment">// &#x5904;&#x7406;&#x6D88;&#x606F;&#x5B9E;&#x73B0;</span>
    <span class="token punctuation">}</span>

<span class="token punctuation">}</span>
</code></pre>
<p>Spring Boot &#x8FD8;<a href="https://docs.spring.io/spring-boot/docs/2.1.4.RELEASE/reference/htmlsingle/#production-ready-metrics-meter" target="_blank">&#x914D;&#x7F6E;&#x5185;&#x7F6E;&#x7684;&#x6D4B;&#x91CF;&#x5DE5;&#x5177;</a>&#xFF08;&#x5373; <code>MeterBinder</code> &#x5B9E;&#x73B0;&#xFF09;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x914D;&#x7F6E;&#x6216;&#x4E13;&#x7528;&#x6CE8;&#x89E3;&#x6807;&#x8BB0;&#x6765;&#x63A7;&#x5236;&#x3002;</p>
<p><a id="production-ready-metrics-export"></a></p>
<h3 id="572&#x3001;&#x652F;&#x6301;&#x7684;&#x76D1;&#x63A7;&#x7CFB;&#x7EDF;">57.2&#x3001;&#x652F;&#x6301;&#x7684;&#x76D1;&#x63A7;&#x7CFB;&#x7EDF;</h3>
<p><a id="production-ready-metrics-export-appoptics"></a></p>
<h4 id="5721&#x3001;appoptics">57.2.1&#x3001;AppOptics</h4>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;AppOptics &#x6CE8;&#x518C;&#x8868;&#x4F1A;&#x5B9A;&#x671F;&#x5C06;&#x6307;&#x6807;&#x63A8;&#x9001;&#x5230; <a href="https://api.appoptics.com/v1/measurements" target="_blank">api.appoptics.com/v1/measurements</a>&#x3002;&#x8981;&#x5C06;&#x6307;&#x6807;&#x5BFC;&#x51FA;&#x5230; SaaS <a href="https://micrometer.io/docs/registry/appoptics" target="_blank">AppOptics</a>&#xFF0C;&#x4F60;&#x5FC5;&#x987B;&#x63D0;&#x4F9B; API &#x4EE4;&#x724C;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.appoptics.api-token</span><span class="token attr-value"><span class="token punctuation">=</span>YOUR_TOKEN</span>
</code></pre>
<p><a id="production-ready-metrics-export-atlas"></a></p>
<h4 id="5722&#x3001;atlas">57.2.2&#x3001;Atlas</h4>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x5EA6;&#x91CF;&#x6807;&#x51C6;&#x5C06;&#x5BFC;&#x51FA;&#x5230;&#x672C;&#x5730;&#x7684; <a href="https://micrometer.io/docs/registry/atlas" target="_blank">Atlas</a>&#x3002;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x65B9;&#x5F0F;&#x6307;&#x5B9A; <a href="https://github.com/Netflix/atlas" target="_blank">Atlas &#x670D;&#x52A1;&#x5668;</a>&#x7684;&#x4F4D;&#x7F6E;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.atlas.uri</span><span class="token attr-value"><span class="token punctuation">=</span>https://atlas.example.com:7101/api/v1/publish</span>
</code></pre>
<p><a id="production-ready-metrics-export-datadog"></a></p>
<h4 id="5723&#x3001;datadog">57.2.3&#x3001;Datadog</h4>
<p>Datadog &#x6CE8;&#x518C;&#x8868;&#x4F1A;&#x5B9A;&#x671F;&#x5C06;&#x6307;&#x6807;&#x63A8;&#x9001;&#x5230; <a href="https://www.datadoghq.com/" target="_blank">datadoghq</a>&#x3002;&#x8981;&#x5C06;&#x6307;&#x6807;&#x5BFC;&#x51FA;&#x5230; <a href="https://micrometer.io/docs/registry/datadog" target="_blank">Datadog</a>&#xFF0C;&#x4F60;&#x5FC5;&#x987B;&#x63D0;&#x4F9B; API &#x5BC6;&#x94A5;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.datadog.api-key</span><span class="token attr-value"><span class="token punctuation">=</span>YOUR_KEY</span>
</code></pre>
<p>&#x4F60;&#x8FD8;&#x53EF;&#x4EE5;&#x66F4;&#x6539;&#x5EA6;&#x91CF;&#x6807;&#x51C6;&#x53D1;&#x9001;&#x5230; Datadog &#x7684;&#x95F4;&#x9694;&#x65F6;&#x95F4;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.datadog.step</span><span class="token attr-value"><span class="token punctuation">=</span>30s</span>
</code></pre>
<p><a id="production-ready-metrics-export-dynatrace"></a></p>
<h4 id="5724&#x3001;dynatrace">57.2.4&#x3001;Dynatrace</h4>
<p>Dynatrace &#x6CE8;&#x518C;&#x8868;&#x5B9A;&#x671F;&#x5C06;&#x6307;&#x6807;&#x63A8;&#x9001;&#x5230;&#x914D;&#x7F6E;&#x7684; URI&#x3002;&#x8981;&#x5C06;&#x6307;&#x6807;&#x5BFC;&#x51FA;&#x5230; <a href="https://micrometer.io/docs/registry/dynatrace" target="_blank">Dynatrace</a>&#xFF0C;&#x5FC5;&#x987B;&#x63D0;&#x4F9B; API &#x4EE4;&#x724C;&#x3001;&#x8BBE;&#x5907; ID &#x548C; URI&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.dynatrace.api-token</span><span class="token attr-value"><span class="token punctuation">=</span>YOUR_TOKEN</span>
<span class="token constant">management.metrics.export.dynatrace.device-id</span><span class="token attr-value"><span class="token punctuation">=</span>YOUR_DEVICE_ID</span>
<span class="token constant">management.metrics.export.dynatrace.uri</span><span class="token attr-value"><span class="token punctuation">=</span>YOUR_URI</span>
</code></pre>
<p>&#x4F60;&#x8FD8;&#x53EF;&#x4EE5;&#x66F4;&#x6539;&#x5EA6;&#x91CF;&#x6807;&#x51C6;&#x53D1;&#x9001;&#x5230; Dynatrace &#x7684;&#x95F4;&#x9694;&#x65F6;&#x95F4;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.dynatrace.step</span><span class="token attr-value"><span class="token punctuation">=</span>30s</span>
</code></pre>
<p><a id="production-ready-metrics-export-elastic"></a></p>
<h4 id="5725&#x3001;elastic">57.2.5&#x3001;Elastic</h4>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x5EA6;&#x91CF;&#x5C06;&#x5BFC;&#x51FA;&#x5230;&#x672C;&#x5730;&#x7684; <a href="https://micrometer.io/docs/registry/elastic" target="_blank">Elastic</a>&#x3002;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x5C5E;&#x6027;&#x63D0;&#x4F9B; Elastic &#x670D;&#x52A1;&#x5668;&#x7684;&#x4F4D;&#x7F6E;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.elastic.host</span><span class="token attr-value"><span class="token punctuation">=</span>https://elastic.example.com:8086</span>
</code></pre>
<p><a id="production-ready-metrics-export-ganglia"></a></p>
<h4 id="5726&#x3001;ganglia">57.2.6&#x3001;Ganglia</h4>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x5EA6;&#x91CF;&#x5C06;&#x5BFC;&#x51FA;&#x5230;&#x672C;&#x5730;&#x7684; <a href="https://micrometer.io/docs/registry/ganglia" target="_blank">Ganglia</a>&#x3002;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x65B9;&#x5F0F;&#x63D0;&#x4F9B; <a href="http://ganglia.sourceforge.net/" target="_blank">Ganglia &#x670D;&#x52A1;&#x5668;</a>&#x4E3B;&#x673A;&#x548C;&#x7AEF;&#x53E3;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.ganglia.host</span><span class="token attr-value"><span class="token punctuation">=</span>ganglia.example.com</span>
<span class="token constant">management.metrics.export.ganglia.port</span><span class="token attr-value"><span class="token punctuation">=</span>9649</span>
</code></pre>
<p><a id="production-ready-metrics-export-graphite"></a></p>
<h4 id="5727&#x3001;graphite">57.2.7&#x3001;Graphite</h4>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x5EA6;&#x91CF;&#x5C06;&#x5BFC;&#x51FA;&#x5230;&#x672C;&#x5730;&#x7684; <a href="https://micrometer.io/docs/registry/graphite" target="_blank">Graphite</a>&#x3002;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x65B9;&#x5F0F;&#x63D0;&#x4F9B; <a href="https://graphiteapp.org/" target="_blank">Graphite &#x670D;&#x52A1;&#x5668;</a>&#x4E3B;&#x673A;&#x548C;&#x7AEF;&#x53E3;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.graphite.host</span><span class="token attr-value"><span class="token punctuation">=</span>graphite.example.com</span>
<span class="token constant">management.metrics.export.graphite.port</span><span class="token attr-value"><span class="token punctuation">=</span>9004</span>
</code></pre>
<p>Micrometer &#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x4E2A;&#x9ED8;&#x8BA4;&#x7684; <code>HierarchicalNameMapper</code>&#xFF0C;&#x5B83;&#x7BA1;&#x7406;&#x7EF4;&#x5EA6;&#x8BA1;&#x6570;&#x5668; id &#x5982;&#x4F55;<a href="https://micrometer.io/docs/registry/graphite#_hierarchical_name_mapping" target="_blank">&#x6620;&#x5C04;&#x5230;&#x5E73;&#x9762;&#x5206;&#x5C42;&#x540D;&#x79F0;</a>&#x3002;</p>
<p><strong>&#x63D0;&#x793A;</strong></p>
<blockquote>
<p>&#x8981;&#x63A7;&#x5236;&#x6B64;&#x884C;&#x4E3A;&#xFF0C;&#x8BF7;&#x5B9A;&#x4E49; <code>GraphiteMeterRegistry</code> &#x5E76;&#x63D0;&#x4F9B;&#x81EA;&#x5DF1;&#x7684; <code>HierarchicalNameMapper</code>&#x3002;&#x9664;&#x975E;&#x4F60;&#x81EA;&#x5DF1;&#x5B9A;&#x4E49;&#xFF0C;&#x5426;&#x5219;&#x4F7F;&#x7528;&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x7684; <code>GraphiteConfig</code> &#x548C; <code>Clock</code> bean&#xFF1A;</p>
</blockquote>
<pre class="language-"><code class="lang-java"><span class="token annotation punctuation">@Bean</span>
<span class="token keyword">public</span> <span class="token class-name">GraphiteMeterRegistry</span> <span class="token function">graphiteMeterRegistry</span><span class="token punctuation">(</span><span class="token class-name">GraphiteConfig</span> config<span class="token punctuation">,</span> <span class="token class-name">Clock</span> clock<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token keyword">new</span> <span class="token class-name">GraphiteMeterRegistry</span><span class="token punctuation">(</span>config<span class="token punctuation">,</span> clock<span class="token punctuation">,</span> MY_HIERARCHICAL_MAPPER<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p><a id="production-ready-metrics-export-humio"></a></p>
<h4 id="5728&#x3001;humio">57.2.8&#x3001;Humio</h4>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;Humio &#x6CE8;&#x518C;&#x8868;&#x4F1A;&#x5B9A;&#x671F;&#x5C06;&#x6307;&#x6807;&#x63A8;&#x9001;&#x5230; <a href="https://cloud.humio.com/" target="_blank">cloud.humio.com</a>&#x3002;&#x8981;&#x5C06;&#x6307;&#x6807;&#x5BFC;&#x51FA;&#x5230; SaaS <a href="https://micrometer.io/docs/registry/humio" target="_blank">Humio</a>&#xFF0C;&#x4F60;&#x5FC5;&#x987B;&#x63D0;&#x4F9B; API &#x4EE4;&#x724C;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.humio.api-token</span><span class="token attr-value"><span class="token punctuation">=</span>YOUR_TOKEN</span>
</code></pre>
<p>&#x4F60;&#x8FD8;&#x5E94;&#x914D;&#x7F6E;&#x4E00;&#x4E2A;&#x6216;&#x591A;&#x4E2A;&#x6807;&#x8BB0;&#xFF0C;&#x4EE5;&#x6807;&#x8BC6;&#x8981;&#x63A8;&#x9001;&#x6307;&#x6807;&#x7684;&#x6570;&#x636E;&#x6E90;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.humio.tags.alpha</span><span class="token attr-value"><span class="token punctuation">=</span>a</span>
<span class="token constant">management.metrics.export.humio.tags.bravo</span><span class="token attr-value"><span class="token punctuation">=</span>b</span>
</code></pre>
<p><a id="production-ready-metrics-export-influx"></a></p>
<h4 id="5729&#x3001;influx">57.2.9&#x3001;Influx</h4>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x5EA6;&#x91CF;&#x5C06;&#x5BFC;&#x51FA;&#x5230;&#x672C;&#x5730;&#x7684; <a href="https://micrometer.io/docs/registry/influx" target="_blank">Influx</a>&#x3002;&#x8981;&#x6307;&#x5B9A; <a href="https://www.influxdata.com/" target="_blank">Influx &#x670D;&#x52A1;&#x5668;</a>&#x7684;&#x4F4D;&#x7F6E;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.influx.uri</span><span class="token attr-value"><span class="token punctuation">=</span>https://influx.example.com:8086</span>
</code></pre>
<p><a id="production-ready-metrics-export-jmx"></a></p>
<h4 id="57210&#x3001;jmx">57.2.10&#x3001;JMX</h4>
<p>Micrometer &#x63D0;&#x4F9B;&#x4E86;&#x4E0E; <a href="https://micrometer.io/docs/registry/jmx" target="_blank">JMX</a> &#x7684;&#x5206;&#x5C42;&#x6620;&#x5C04;&#xFF0C;&#x4E3B;&#x8981;&#x4E3A;&#x4E86;&#x65B9;&#x4FBF;&#x5728;&#x672C;&#x5730;&#x67E5;&#x770B;&#x6307;&#x6807;&#x4E14;&#x53EF;&#x79FB;&#x690D;&#x3002;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x5EA6;&#x91CF;&#x5C06;&#x5BFC;&#x51FA;&#x5230; <code>metrics</code> JMX &#x57DF;&#x3002;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x65B9;&#x5F0F;&#x63D0;&#x4F9B;&#x8981;&#x4F7F;&#x7528;&#x7684;&#x57DF;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.jmx.domain</span><span class="token attr-value"><span class="token punctuation">=</span>com.example.app.metrics</span>
</code></pre>
<p>Micrometer &#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x4E2A;&#x9ED8;&#x8BA4;&#x7684; <code>HierarchicalNameMapper</code>&#xFF0C;&#x5B83;&#x7BA1;&#x7406;&#x7EF4;&#x5EA6;&#x8BA1;&#x6570;&#x5668; id &#x5982;&#x4F55;<a href="https://micrometer.io/docs/registry/jmx#_hierarchical_name_mapping" target="_blank">&#x6620;&#x5C04;&#x5230;&#x5E73;&#x9762;&#x5206;&#x5C42;&#x540D;&#x79F0;</a>&#x3002;</p>
<p><strong>&#x63D0;&#x793A;</strong></p>
<blockquote>
<p>&#x8981;&#x63A7;&#x5236;&#x6B64;&#x884C;&#x4E3A;&#xFF0C;&#x8BF7;&#x5B9A;&#x4E49; <code>JmxMeterRegistry</code> &#x5E76;&#x63D0;&#x4F9B;&#x81EA;&#x5DF1;&#x7684; <code>HierarchicalNameMapper</code>&#x3002;&#x9664;&#x975E;&#x4F60;&#x81EA;&#x5DF1;&#x5B9A;&#x4E49;&#xFF0C;&#x5426;&#x5219;&#x4F7F;&#x7528;&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x7684; <code>JmxConfig</code> &#x548C; <code>Clock</code> bean&#xFF1A;</p>
</blockquote>
<pre class="language-"><code class="lang-java"><span class="token annotation punctuation">@Bean</span>
<span class="token keyword">public</span> <span class="token class-name">JmxMeterRegistry</span> <span class="token function">jmxMeterRegistry</span><span class="token punctuation">(</span><span class="token class-name">JmxConfig</span> config<span class="token punctuation">,</span> <span class="token class-name">Clock</span> clock<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token keyword">new</span> <span class="token class-name">JmxMeterRegistry</span><span class="token punctuation">(</span>config<span class="token punctuation">,</span> clock<span class="token punctuation">,</span> MY_HIERARCHICAL_MAPPER<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p><a id="production-ready-metrics-export-kairos"></a></p>
<h4 id="57211&#x3001;kairosdb">57.2.11&#x3001;KairosDB</h4>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x5EA6;&#x91CF;&#x5C06;&#x5BFC;&#x51FA;&#x5230;&#x672C;&#x5730;&#x7684; <a href="https://micrometer.io/docs/registry/kairos" target="_blank">KairosDB</a>&#x3002;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x65B9;&#x5F0F;&#x63D0;&#x4F9B; <a href="https://kairosdb.github.io/" target="_blank">KairosDB &#x670D;&#x52A1;&#x5668;</a>&#x7684;&#x4F4D;&#x7F6E;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.kairos.uri</span><span class="token attr-value"><span class="token punctuation">=</span>https://kairosdb.example.com:8080/api/v1/datapoints</span>
</code></pre>
<p><a id="production-ready-metrics-export-newrelic"></a></p>
<h4 id="57212&#x3001;new-relic">57.2.12&#x3001;New Relic</h4>
<p>New Relic &#x6CE8;&#x518C;&#x8868;&#x5B9A;&#x671F;&#x5C06;&#x6307;&#x6807;&#x63A8;&#x9001;&#x5230; <a href="https://micrometer.io/docs/registry/new-relic" target="_blank">New Relic</a>&#x3002;&#x8981;&#x5C06;&#x6307;&#x6807;&#x5BFC;&#x51FA;&#x5230; <a href="https://newrelic.com/" target="_blank">New Relic</a>&#xFF0C;&#x4F60;&#x5FC5;&#x987B;&#x63D0;&#x4F9B; API &#x5BC6;&#x94A5;&#x548C;&#x5E10;&#x6237; ID&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.newrelic.api-key</span><span class="token attr-value"><span class="token punctuation">=</span>YOUR_KEY</span>
<span class="token constant">management.metrics.export.newrelic.account-id</span><span class="token attr-value"><span class="token punctuation">=</span>YOUR_ACCOUNT_ID</span>
</code></pre>
<p>&#x4F60;&#x8FD8;&#x53EF;&#x4EE5;&#x66F4;&#x6539;&#x5C06;&#x5EA6;&#x91CF;&#x53D1;&#x9001;&#x5230; New Relic &#x7684;&#x95F4;&#x9694;&#x65F6;&#x95F4;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.newrelic.step</span><span class="token attr-value"><span class="token punctuation">=</span>30s</span>
</code></pre>
<p><a id="production-ready-metrics-export-prometheus"></a></p>
<h4 id="57213&#x3001;prometheus">57.2.13&#x3001;Prometheus</h4>
<p><a href="https://micrometer.io/docs/registry/prometheus" target="_blank">Prometheus</a> &#x5E0C;&#x671B;&#x6293;&#x53D6;&#x6216;&#x8F6E;&#x8BE2;&#x5404;&#x4E2A;&#x5E94;&#x7528;&#x5B9E;&#x4F8B;&#x4EE5;&#x83B7;&#x53D6;&#x6307;&#x6807;&#x6570;&#x636E;&#x3002;Spring Boot &#x5728; <code>/actuator/prometheus</code> &#x4E0A;&#x63D0;&#x4F9B; actuator &#x7AEF;&#x70B9;&#xFF0C;&#x4EE5;&#x9002;&#x5F53;&#x7684;&#x683C;&#x5F0F;&#x5448;&#x73B0; <a href="https://prometheus.io/" target="_blank">Prometheus scrape </a>&#x3002;</p>
<p><strong>&#x63D0;&#x793A;</strong></p>
<blockquote>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#x7AEF;&#x70B9;&#x4E0D;&#x53EF;&#x7528;&#xFF0C;&#x5FC5;&#x987B;&#x66B4;&#x9732;&#xFF0C;&#x8BF7;&#x53C2;&#x9605;<a href="#production-ready-endpoints-exposing-endpoints">&#x66B4;&#x9732;&#x7AEF;&#x70B9;</a>&#x4EE5;&#x83B7;&#x53D6;&#x66F4;&#x591A;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#x3002;</p>
</blockquote>
<p>&#x4EE5;&#x4E0B;&#x662F;&#x8981;&#x6DFB;&#x52A0;&#x5230; <code>prometheus.yml</code> &#x7684;&#x793A;&#x4F8B; <code>scrape_config</code>&#xFF1A;</p>
<pre class="language-"><code class="lang-yaml"><span class="token key atrule">scrape_configs</span><span class="token punctuation">:</span>
  <span class="token punctuation">-</span> <span class="token key atrule">job_name</span><span class="token punctuation">:</span> <span class="token string">&apos;spring&apos;</span>
    <span class="token key atrule">metrics_path</span><span class="token punctuation">:</span> <span class="token string">&apos;/actuator/prometheus&apos;</span>
    <span class="token key atrule">static_configs</span><span class="token punctuation">:</span>
      <span class="token punctuation">-</span> <span class="token key atrule">targets</span><span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&apos;HOST:PORT&apos;</span><span class="token punctuation">]</span>
</code></pre>
<p><a id="production-ready-metrics-export-signalfx"></a></p>
<h4 id="57214&#x3001;signalfx">57.2.14&#x3001;SignalFx</h4>
<p>SignalFx &#x6CE8;&#x518C;&#x8868;&#x5B9A;&#x671F;&#x5C06;&#x6307;&#x6807;&#x63A8;&#x9001;&#x5230; <a href="https://micrometer.io/docs/registry/signalfx" target="_blank">SignalFx</a>&#x3002;&#x8981;&#x5C06;&#x6307;&#x6807;&#x5BFC;&#x51FA;&#x5230; <a href="https://signalfx.com/" target="_blank">SignalFx</a>&#xFF0C;&#x4F60;&#x5FC5;&#x987B;&#x63D0;&#x4F9B;&#x8BBF;&#x95EE;&#x4EE4;&#x724C;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.signalfx.access-token</span><span class="token attr-value"><span class="token punctuation">=</span>YOUR_ACCESS_TOKEN</span>
</code></pre>
<p>&#x4F60;&#x8FD8;&#x53EF;&#x4EE5;&#x66F4;&#x6539;&#x5C06;&#x6307;&#x6807;&#x53D1;&#x9001;&#x5230; SignalFx &#x7684;&#x95F4;&#x9694;&#x65F6;&#x95F4;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.signalfx.step</span><span class="token attr-value"><span class="token punctuation">=</span>30s</span>
</code></pre>
<p><a id="production-ready-metrics-export-simple"></a></p>
<h4 id="57215&#x3001;simple">57.2.15&#x3001;Simple</h4>
<p>Micrometer &#x9644;&#x5E26;&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684;&#x5185;&#x5B58;&#x540E;&#x7AEF;&#xFF0C;&#x5982;&#x679C;&#x6CA1;&#x6709;&#x914D;&#x7F6E;&#x5176;&#x4ED6;&#x6CE8;&#x518C;&#x8868;&#xFF0C;&#x5B83;&#x5C06;&#x81EA;&#x52A8;&#x7528;&#x4F5C;&#x540E;&#x5907;&#x3002;&#x8FD9;&#x4F7F;&#x4F60;&#x53EF;&#x4EE5;&#x67E5;&#x770B;<a href="#production-ready-metrics-endpoint">&#x6307;&#x6807;&#x7AEF;&#x70B9;</a>&#x4E2D;&#x6536;&#x96C6;&#x7684;&#x6307;&#x6807;&#x4FE1;&#x606F;&#x3002;</p>
<p>&#x53EA;&#x8981;&#x4F60;&#x4F7F;&#x7528;&#x4E86;&#x4EFB;&#x4F55;&#x5176;&#x4ED6;&#x53EF;&#x7528;&#x7684;&#x540E;&#x7AEF;&#xFF0C;&#x5185;&#x5B58;&#x540E;&#x7AEF;&#x5C31;&#x4F1A;&#x81EA;&#x52A8;&#x7981;&#x7528;&#x3002;&#x4F60;&#x4E5F;&#x53EF;&#x4EE5;&#x663E;&#x5F0F;&#x7981;&#x7528;&#x5B83;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.simple.enabled</span><span class="token attr-value"><span class="token punctuation">=</span>false</span>
</code></pre>
<p><a id="production-ready-metrics-export-statsd"></a></p>
<h4 id="57216&#x3001;statsd">57.2.16&#x3001;StatsD</h4>
<p>StatsD &#x6CE8;&#x518C;&#x8868;&#x5C06; UDP &#x4E0A;&#x7684;&#x6307;&#x6807;&#x63A8;&#x9001;&#x5230; <a href="https://micrometer.io/docs/registry/statsd" target="_blank">StatsD</a> &#x4EE3;&#x7406;&#x3002; &#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x5EA6;&#x91CF;&#x5C06;&#x5BFC;&#x51FA;&#x5230;&#x672C;&#x5730;&#x7684; StatsD &#x4EE3;&#x7406;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x65B9;&#x5F0F;&#x63D0;&#x4F9B; StatsD &#x4EE3;&#x7406;&#x4E3B;&#x673A;&#x548C;&#x7AEF;&#x53E3;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.statsd.host</span><span class="token attr-value"><span class="token punctuation">=</span>statsd.example.com</span>
<span class="token constant">management.metrics.export.statsd.port</span><span class="token attr-value"><span class="token punctuation">=</span>9125</span>
</code></pre>
<p>&#x4F60;&#x8FD8;&#x53EF;&#x4EE5;&#x66F4;&#x6539;&#x8981;&#x4F7F;&#x7528;&#x7684; StatsD &#x7EBF;&#x8DEF;&#x534F;&#x8BAE;&#xFF08;&#x9ED8;&#x8BA4;&#x4E3A; Datadog&#xFF09;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.statsd.flavor</span><span class="token attr-value"><span class="token punctuation">=</span>etsy</span>
</code></pre>
<p><a id="production-ready-metrics-export-wavefront"></a></p>
<h4 id="57217&#x3001;wavefront">57.2.17&#x3001;Wavefront</h4>
<p>Wavefront &#x6CE8;&#x518C;&#x8868;&#x5B9A;&#x671F;&#x5C06;&#x6307;&#x6807;&#x63A8;&#x9001;&#x5230; <a href="https://micrometer.io/docs/registry/wavefront" target="_blank">Wavefront</a>&#x3002;&#x5982;&#x679C;&#x8981;&#x5C06;&#x6307;&#x6807;&#x76F4;&#x63A5;&#x5BFC;&#x51FA;&#x5230; <a href="https://www.wavefront.com/" target="_blank">Wavefront</a>&#xFF0C;&#x5219;&#x4F60;&#x5FC5;&#x987B;&#x63D0;&#x4F9B; API &#x4EE4;&#x724C;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.wavefront.api-token</span><span class="token attr-value"><span class="token punctuation">=</span>YOUR_API_TOKEN</span>
</code></pre>
<p>&#x6216;&#x8005;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x5728;&#x73AF;&#x5883;&#x4E2D;&#x4F7F;&#x7528; Wavefront sidecar &#x6216;&#x5185;&#x90E8;&#x4EE3;&#x7406;&#x8BBE;&#x7F6E;&#xFF0C;&#x5C06;&#x6307;&#x6807;&#x6570;&#x636E;&#x8F6C;&#x53D1;&#x5230; Wavefront API &#x4E3B;&#x673A;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.wavefront.uri</span><span class="token attr-value"><span class="token punctuation">=</span>proxy://localhost:2878</span>
</code></pre>
<p><strong>&#x63D0;&#x793A;</strong></p>
<blockquote>
<p>&#x5982;&#x679C;&#x5C06;&#x5EA6;&#x91CF;&#x53D1;&#x5E03;&#x5230; Wavefront &#x4EE3;&#x7406;&#xFF08;&#x5982;<a href="https://docs.wavefront.com/proxies_installing.html" target="_blank">&#x6587;&#x6863;</a>&#x4E2D;&#x6240;&#x8FF0;&#xFF09;&#xFF0C;&#x5219;&#x4E3B;&#x673A;&#x5FC5;&#x987B;&#x91C7;&#x7528; <code>proxy://HOST:PORT</code> &#x683C;&#x5F0F;&#x3002;</p>
</blockquote>
<p>&#x4F60;&#x8FD8;&#x53EF;&#x4EE5;&#x66F4;&#x6539;&#x5C06;&#x6307;&#x6807;&#x53D1;&#x9001;&#x5230; Wavefront &#x7684;&#x95F4;&#x9694;&#x65F6;&#x95F4;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.export.wavefront.step</span><span class="token attr-value"><span class="token punctuation">=</span>30s</span>
</code></pre>
<p><a id="production-ready-metrics-meter"></a></p>
<h3 id="573&#x3001;&#x652F;&#x6301;&#x7684;&#x6307;&#x6807;">57.3&#x3001;&#x652F;&#x6301;&#x7684;&#x6307;&#x6807;</h3>
<p>Spring Boot &#x5728;&#x9002;&#x5F53;&#x7684;&#x73AF;&#x5883;&#x6CE8;&#x518C;&#x4EE5;&#x4E0B;&#x6838;&#x5FC3;&#x6307;&#x6807;&#xFF1A;</p>
<ul>
<li>JVM &#x6307;&#x6807;&#xFF0C;&#x62A5;&#x544A;&#x5229;&#x7528;&#x7387;&#xFF1A;<ul>
<li>&#x5404;&#x79CD;&#x5185;&#x5B58;&#x548C;&#x7F13;&#x51B2;&#x6C60;</li>
<li>&#x4E0E;&#x5783;&#x573E;&#x56DE;&#x6536;&#x6709;&#x5173;&#x7684;&#x7EDF;&#x8BA1;</li>
<li>&#x7EBF;&#x7A0B;&#x5229;&#x7528;&#x7387;</li>
<li>&#x52A0;&#x8F7D;/&#x5378;&#x8F7D; class &#x7684;&#x6570;&#x91CF;</li>
</ul>
</li>
<li>CPU &#x6307;&#x6807;</li>
<li>&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x6307;&#x6807;</li>
<li>Kafka &#x6D88;&#x8D39;&#x8005;&#x6307;&#x6807;</li>
<li>Log4j2 &#x6307;&#x6807;&#xFF1A;&#x8BB0;&#x5F55;&#x6BCF;&#x4E2A;&#x7EA7;&#x522B;&#x8BB0;&#x5F55;&#x5230; Log4j2 &#x7684;&#x4E8B;&#x4EF6;&#x6570;</li>
<li>Logback &#x6307;&#x6807;&#xFF1A;&#x8BB0;&#x5F55;&#x6BCF;&#x4E2A;&#x7EA7;&#x522B;&#x8BB0;&#x5F55;&#x5230; Logback &#x7684;&#x4E8B;&#x4EF6;&#x6570;</li>
<li>&#x6B63;&#x5E38;&#x8FD0;&#x884C;&#x65F6;&#x95F4;&#x6307;&#x6807;&#xFF1A;&#x62A5;&#x544A;&#x6B63;&#x5E38;&#x8FD0;&#x884C;&#x65F6;&#x95F4;&#x548C;&#x8868;&#x793A;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x7EDD;&#x5BF9;&#x542F;&#x52A8;&#x65F6;&#x95F4;&#x7684;&#x56FA;&#x5B9A;&#x8BA1;&#x91CF;&#x503C;</li>
<li>Tomcat &#x6307;&#x6807;</li>
<li><a href="https://docs.spring.io/spring-integration/docs/current/reference/html/system-management-chapter.html#micrometer-integration" target="_blank">Spring Integration</a> &#x6307;&#x6807;</li>
</ul>
<p><a id="production-ready-metrics-spring-mvc"></a></p>
<h4 id="5731&#x3001;spring-mvc-&#x6307;&#x6807;">57.3.1&#x3001;Spring MVC &#x6307;&#x6807;</h4>
<p>&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x542F;&#x7528; Spring MVC &#x5904;&#x7406;&#x7684;&#x8BF7;&#x6C42;&#x7684;&#x6307;&#x6807;&#x8BB0;&#x5F55;&#x3002;&#x5F53; <code>management.metrics.web.server.auto-time-requests</code> &#x4E3A; <code>true</code> &#x65F6;&#xFF0C;&#x5C06;&#x5BF9;&#x6240;&#x6709;&#x8BF7;&#x6C42;&#x8FDB;&#x884C;&#x6B64;&#x68C0;&#x6D4B;&#x3002;&#x6216;&#x8005;&#xFF0C;&#x5F53;&#x8BBE;&#x7F6E;&#x4E3A; <code>false</code> &#x65F6;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x5C06; <code>@Timed</code> &#x6DFB;&#x52A0;&#x5230;&#x8BF7;&#x6C42;&#x5904;&#x7406;&#x65B9;&#x6CD5;&#x6765;&#x542F;&#x7528;&#x68C0;&#x6D4B;&#xFF1A;</p>
<pre class="language-"><code class="lang-java"><span class="token annotation punctuation">@RestController</span>
<span class="token annotation punctuation">@Timed</span> <span class="token comment">// &lt;1&gt;</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">MyController</span> <span class="token punctuation">{</span>

    <span class="token annotation punctuation">@GetMapping</span><span class="token punctuation">(</span><span class="token string">&quot;/api/people&quot;</span><span class="token punctuation">)</span>
    <span class="token annotation punctuation">@Timed</span><span class="token punctuation">(</span>extraTags <span class="token operator">=</span> <span class="token punctuation">{</span> <span class="token string">&quot;region&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;us-east-1&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">)</span> <span class="token comment">// &lt;2&gt;</span>
    <span class="token annotation punctuation">@Timed</span><span class="token punctuation">(</span>value <span class="token operator">=</span> <span class="token string">&quot;all.people&quot;</span><span class="token punctuation">,</span> longTask <span class="token operator">=</span> <span class="token boolean">true</span><span class="token punctuation">)</span> <span class="token comment">// &lt;3&gt;</span>
    <span class="token keyword">public</span> <span class="token class-name">List</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">Person</span><span class="token punctuation">&gt;</span></span> <span class="token function">listPeople</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <span class="token punctuation">}</span>

<span class="token punctuation">}</span>
</code></pre>
<ol>
<li>&#x4E00;&#x4E2A;&#x63A7;&#x5236;&#x5668;&#x7C7B;&#xFF0C;&#x4E3A;&#x63A7;&#x5236;&#x5668;&#x4E2D;&#x7684;&#x6BCF;&#x4E2A;&#x8BF7;&#x6C42;&#x5904;&#x7406;&#x7A0B;&#x5E8F;&#x542F;&#x7528;&#x8BA1;&#x65F6;&#x3002;</li>
<li>&#x542F;&#x7528;&#x5355;&#x4E2A;&#x7AEF;&#x70B9;&#x3002;&#x5982;&#x679C;&#x4F60;&#x5728;&#x7C7B;&#x4E0A;&#x4F7F;&#x7528;&#x4E86;&#x5B83;&#xFF0C;&#x5C31;&#x4E0D;&#x9700;&#x8981;&#x5728;&#x65B9;&#x6CD5;&#x4E0A;&#x518D;&#x6B21;&#x58F0;&#x660E;&#xFF0C;&#x4F46;&#x53EF;&#x4EE5;&#x7528;&#x5B83;&#x6765;&#x8FDB;&#x4E00;&#x6B65;&#x81EA;&#x5B9A;&#x4E49;&#x8BE5;&#x7279;&#x5B9A;&#x7AEF;&#x70B9;&#x7684;&#x8BA1;&#x65F6;&#x5668;&#x3002;</li>
<li>&#x4F7F;&#x7528; <code>longTask = true</code> &#x7684;&#x65B9;&#x6CD5;&#x4E3A;&#x8BE5;&#x65B9;&#x6CD5;&#x542F;&#x7528;&#x957F;&#x4EFB;&#x52A1;&#x8BA1;&#x65F6;&#x5668;&#x3002;&#x957F;&#x4EFB;&#x52A1;&#x8BA1;&#x65F6;&#x5668;&#x9700;&#x8981;&#x5355;&#x72EC;&#x7684;&#x6307;&#x6807;&#x540D;&#x79F0;&#xFF0C;&#x5E76;&#x4E14;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x77ED;&#x4EFB;&#x52A1;&#x8BA1;&#x65F6;&#x5668;&#x8FDB;&#x884C;&#x5806;&#x53E0;&#x3002;</li>
</ol>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x4F7F;&#x7528;&#x540D;&#x79F0;&#x4E3A; <code>http.server.requests</code> &#x751F;&#x6210;&#x5EA6;&#x91CF;&#x6307;&#x6807;&#x3002;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8BBE;&#x7F6E; <code>management.metrics.web.server.requests-metric-name</code> &#x5C5E;&#x6027;&#x6765;&#x81EA;&#x5B9A;&#x4E49;&#x540D;&#x79F0;&#x3002;</p>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;Spring MVC &#x76F8;&#x5173;&#x6307;&#x6807;&#x4F7F;&#x7528;&#x4E86;&#x4EE5;&#x4E0B;&#x6807;&#x7B7E;&#x6807;&#x8BB0;&#xFF1A;</p>
<table>
<thead>
<tr>
<th>&#x6807;&#x7B7E;</th>
<th>&#x63CF;&#x8FF0;</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>exception</code></td>
<td>&#x5904;&#x7406;&#x8BF7;&#x6C42;&#x65F6;&#x629B;&#x51FA;&#x7684;&#x5F02;&#x5E38;&#x7684;&#x7B80;&#x5355;&#x7C7B;&#x540D;&#x3002;</td>
</tr>
<tr>
<td><code>method</code></td>
<td>&#x8BF7;&#x6C42;&#x7684;&#x65B9;&#x6CD5;&#xFF08;&#x4F8B;&#x5982;&#xFF0C;<code>GET</code> &#x6216; <code>POST</code>&#xFF09;</td>
</tr>
<tr>
<td><code>outcome</code></td>
<td>&#x6839;&#x636E;&#x54CD;&#x5E94;&#x72B6;&#x6001;&#x7801;&#x751F;&#x6210;&#x7ED3;&#x679C;&#x3002;1xx &#x662F; <code>INFORMATIONAL</code>&#xFF0C;2xx &#x662F; <code>SUCCESS</code>&#xFF0C;3xx &#x662F; <code>REDIRECTION</code>&#xFF0C;4xx &#x662F; <code>CLIENT_ERROR</code>&#xFF0C;5xx &#x662F; <code>SERVER_ERROR</code></td>
</tr>
<tr>
<td><code>status</code></td>
<td>&#x54CD;&#x5E94;&#x7684; HTTP &#x72B6;&#x6001;&#x7801;&#xFF08;&#x4F8B;&#x5982;&#xFF0C;<code>200</code> &#x6216; <code>500</code>&#xFF09;</td>
</tr>
<tr>
<td><code>uri</code></td>
<td>&#x5982;&#x679C;&#x53EF;&#x80FD;&#xFF0C;&#x5728;&#x53D8;&#x91CF;&#x66FF;&#x6362;&#x4E4B;&#x524D;&#x8BF7;&#x6C42; URI &#x6A21;&#x677F;&#xFF08;&#x4F8B;&#x5982;&#xFF0C;<code>/api/person/{id}</code>&#xFF09;</td>
</tr>
</tbody>
</table>
<p>&#x8981;&#x81EA;&#x5B9A;&#x4E49;&#x6807;&#x7B7E;&#xFF0C;&#x8BF7;&#x63D0;&#x4F9B;&#x4E00;&#x4E2A;&#x5B9E;&#x73B0;&#x4E86; <code>WebMvcTagsProvider</code> &#x7684; <code>@Bean</code>&#x3002;</p>
<p><a id="production-ready-metrics-web-flux"></a></p>
<h4 id="5732&#x3001;spring-webflux-&#x6307;&#x6807;">57.3.2&#x3001;Spring WebFlux &#x6307;&#x6807;</h4>
<p>&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x542F;&#x7528;&#x4E86; WebFlux &#x63A7;&#x5236;&#x5668;&#x548C;&#x51FD;&#x6570;&#x5F0F;&#x5904;&#x7406;&#x7A0B;&#x5E8F;&#x5904;&#x7406;&#x7684;&#x6240;&#x6709;&#x8BF7;&#x6C42;&#x7684;&#x6307;&#x6807;&#x8BB0;&#x5F55;&#x529F;&#x80FD;&#x3002;</p>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x4F7F;&#x7528;&#x540D;&#x4E3A; <code>http.server.requests</code> &#x751F;&#x6210;&#x5EA6;&#x91CF;&#x6307;&#x6807;&#x3002;&#x4F60;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8BBE;&#x7F6E; <code>management.metrics.web.server.requests-metric-name</code> &#x5C5E;&#x6027;&#x6765;&#x81EA;&#x5B9A;&#x4E49;&#x540D;&#x79F0;&#x3002;</p>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x4E0E; WebFlux &#x76F8;&#x5173;&#x7684;&#x6307;&#x6807;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x6807;&#x7B7E;&#x6807;&#x8BB0;&#xFF1A;</p>
<table>
<thead>
<tr>
<th>&#x6807;&#x7B7E;</th>
<th>&#x63CF;&#x8FF0;</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>exception</code></td>
<td>&#x5904;&#x7406;&#x8BF7;&#x6C42;&#x65F6;&#x629B;&#x51FA;&#x7684;&#x5F02;&#x5E38;&#x7684;&#x7B80;&#x5355;&#x7C7B;&#x540D;&#x3002;</td>
</tr>
<tr>
<td><code>method</code></td>
<td>&#x8BF7;&#x6C42;&#x65B9;&#x6CD5;&#xFF08;&#x4F8B;&#x5982;&#xFF0C;<code>GET</code>&#x6216; <code>POST</code>&#xFF09;</td>
</tr>
<tr>
<td><code>outcome</code></td>
<td>&#x6839;&#x636E;&#x54CD;&#x5E94;&#x72B6;&#x6001;&#x7801;&#x751F;&#x6210;&#x8BF7;&#x6C42;&#x7ED3;&#x679C;&#x3002;1xx &#x662F; <code>INFORMATIONAL</code>&#xFF0C;2xx &#x662F; <code>SUCCESS</code>&#xFF0C;3xx &#x662F; <code>REDIRECTION</code>&#xFF0C;4xx &#x662F; <code>CLIENT_ERROR</code>&#xFF0C;5xx &#x662F; <code>SERVER_ERROR</code></td>
</tr>
<tr>
<td><code>status</code></td>
<td>&#x54CD;&#x5E94;&#x7684; HTTP &#x72B6;&#x6001;&#x7801;&#xFF08;&#x4F8B;&#x5982;&#xFF0C;<code>200</code> &#x6216; <code>500</code>&#xFF09;</td>
</tr>
<tr>
<td><code>uri</code></td>
<td>&#x5982;&#x679C;&#x53EF;&#x80FD;&#xFF0C;&#x5728;&#x53D8;&#x91CF;&#x66FF;&#x6362;&#x4E4B;&#x524D;&#x8BF7;&#x6C42; URI &#x6A21;&#x677F;&#xFF08;&#x4F8B;&#x5982;&#xFF0C;<code>/api/person/{id}</code>&#xFF09;</td>
</tr>
</tbody>
</table>
<p>&#x8981;&#x81EA;&#x5B9A;&#x4E49;&#x6807;&#x7B7E;&#xFF0C;&#x8BF7;&#x63D0;&#x4F9B;&#x4E00;&#x4E2A;&#x5B9E;&#x73B0;&#x4E86; <code>WebFluxTagsProvider</code> &#x7684; <code>@Bean</code>&#x3002;</p>
<p><a id="production-ready-metrics-jersey-server"></a></p>
<h4 id="5733&#x3001;jersey-server-&#x6307;&#x6807;">57.3.3&#x3001;Jersey Server &#x6307;&#x6807;</h4>
<p>&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x542F;&#x7528;&#x4E86;&#x7531; Jersey JAX-RS &#x5B9E;&#x73B0;&#x5904;&#x7406;&#x7684;&#x8BF7;&#x6C42;&#x7684;&#x6307;&#x6807;&#x8BB0;&#x5F55;&#x529F;&#x80FD;&#x3002;&#x5F53; <code>management.metrics.web.server.auto-time-requests</code> &#x4E3A; <code>true</code> &#x65F6;&#xFF0C;&#x5C06;&#x5BF9;&#x6240;&#x6709;&#x8BF7;&#x6C42;&#x8FDB;&#x884C;&#x8BE5;&#x9879;&#x68C0;&#x6D4B;&#x3002;&#x5F53;&#x8BBE;&#x7F6E;&#x4E3A; <code>false</code> &#x65F6;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x5C06; <code>@Timed</code> &#x6DFB;&#x52A0;&#x5230;&#x8BF7;&#x6C42;&#x5904;&#x7406;&#x65B9;&#x6CD5;&#x4E0A;&#x6765;&#x542F;&#x7528;&#x68C0;&#x6D4B;&#xFF1A;</p>
<pre class="language-"><code class="lang-java"><span class="token annotation punctuation">@Component</span>
<span class="token annotation punctuation">@Path</span><span class="token punctuation">(</span><span class="token string">&quot;/api/people&quot;</span><span class="token punctuation">)</span>
<span class="token annotation punctuation">@Timed</span> <span class="token comment">// &lt;1&gt;</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">Endpoint</span> <span class="token punctuation">{</span>
    <span class="token annotation punctuation">@GET</span>
    <span class="token annotation punctuation">@Timed</span><span class="token punctuation">(</span>extraTags <span class="token operator">=</span> <span class="token punctuation">{</span> <span class="token string">&quot;region&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;us-east-1&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">)</span> <span class="token comment">// &lt;2&gt;</span>
    <span class="token annotation punctuation">@Timed</span><span class="token punctuation">(</span>value <span class="token operator">=</span> <span class="token string">&quot;all.people&quot;</span><span class="token punctuation">,</span> longTask <span class="token operator">=</span> <span class="token boolean">true</span><span class="token punctuation">)</span> <span class="token comment">// &lt;3&gt;</span>
    <span class="token keyword">public</span> <span class="token class-name">List</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">Person</span><span class="token punctuation">&gt;</span></span> <span class="token function">listPeople</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<ol>
<li>&#x5728;&#x8D44;&#x6E90;&#x7C7B;&#x4E0A;&#xFF0C;&#x4E3A;&#x8D44;&#x6E90;&#x4E2D;&#x7684;&#x6BCF;&#x4E2A;&#x8BF7;&#x6C42;&#x5904;&#x7406;&#x7A0B;&#x5E8F;&#x542F;&#x7528;&#x8BA1;&#x65F6;&#x3002;</li>
<li>&#x5728;&#x65B9;&#x6CD5;&#x4E0A;&#x5219;&#x542F;&#x7528;&#x5355;&#x4E2A;&#x7AEF;&#x70B9;&#x3002;&#x5982;&#x679C;&#x4F60;&#x5728;&#x7C7B;&#x4E0A;&#x4F7F;&#x7528;&#x4E86;&#x5B83;&#xFF0C;&#x5219;&#x4E0D;&#x9700;&#x5728;&#x65B9;&#x6CD5;&#x4E0A;&#x518D;&#x6B21;&#x58F0;&#x660E;&#xFF0C;&#x4F46;&#x53EF;&#x4EE5;&#x7528;&#x5B83;&#x6765;&#x8FDB;&#x4E00;&#x6B65;&#x81EA;&#x5B9A;&#x4E49;&#x8BE5;&#x7279;&#x5B9A;&#x7AEF;&#x70B9;&#x7684;&#x8BA1;&#x65F6;&#x5668;&#x3002;</li>
<li>&#x5728;&#x6709; <code>longTask = true</code> &#x7684;&#x65B9;&#x6CD5;&#x4E0A;&#xFF0C;&#x4E3A;&#x8BE5;&#x65B9;&#x6CD5;&#x542F;&#x7528;&#x957F;&#x4EFB;&#x52A1;&#x8BA1;&#x65F6;&#x5668;&#x3002;&#x957F;&#x4EFB;&#x52A1;&#x8BA1;&#x65F6;&#x5668;&#x9700;&#x8981;&#x5355;&#x72EC;&#x7684;&#x5EA6;&#x91CF;&#x540D;&#x79F0;&#xFF0C;&#x5E76;&#x4E14;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x77ED;&#x4EFB;&#x52A1;&#x8BA1;&#x65F6;&#x5668;&#x8FDB;&#x884C;&#x5806;&#x53E0;&#x3002;</li>
</ol>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x4F7F;&#x7528;&#x540D;&#x4E3A; <code>http.server.requests</code> &#x751F;&#x6210;&#x5EA6;&#x91CF;&#x6307;&#x6807;&#x3002;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8BBE;&#x7F6E; <code>management.metrics.web.server.requests-metric-name</code> &#x5C5E;&#x6027;&#x6765;&#x81EA;&#x5B9A;&#x4E49;&#x540D;&#x79F0;&#x3002;</p>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;Jersey &#x670D;&#x52A1;&#x5668;&#x6307;&#x6807;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x6807;&#x7B7E;&#x6807;&#x8BB0;&#xFF1A;</p>
<table>
<thead>
<tr>
<th>&#x6807;&#x7B7E;</th>
<th>&#x63CF;&#x8FF0;</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>exception</code></td>
<td>&#x5904;&#x7406;&#x8BF7;&#x6C42;&#x65F6;&#x629B;&#x51FA;&#x7684;&#x5F02;&#x5E38;&#x7684;&#x7B80;&#x5355;&#x7C7B;&#x540D;&#x3002;</td>
</tr>
<tr>
<td><code>method</code></td>
<td>&#x8BF7;&#x6C42;&#x7684;&#x65B9;&#x6CD5;&#xFF08;&#x4F8B;&#x5982;&#xFF0C;<code>GET</code> &#x6216; <code>POST</code>&#xFF09;</td>
</tr>
<tr>
<td><code>outcome</code></td>
<td>&#x6839;&#x636E;&#x54CD;&#x5E94;&#x72B6;&#x6001;&#x7801;&#x751F;&#x6210;&#x7684;&#x8BF7;&#x6C42;&#x7ED3;&#x679C;&#x3002;1xx &#x662F; <code>INFORMATIONAL</code>&#xFF0C;2xx &#x662F; <code>SUCCESS</code>&#xFF0C;3xx &#x662F; <code>REDIRECTION</code>&#xFF0C;4xx &#x662F; <code>CLIENT_ERROR</code>&#xFF0C;5xx &#x662F; <code>SERVER_ERROR</code></td>
</tr>
<tr>
<td><code>status</code></td>
<td>&#x54CD;&#x5E94;&#x7684; HTTP &#x72B6;&#x6001;&#x7801;&#xFF08;&#x4F8B;&#x5982;&#xFF0C;<code>200</code>&#x6216; <code>500</code>&#xFF09;</td>
</tr>
<tr>
<td><code>uri</code></td>
<td>&#x5982;&#x679C;&#x53EF;&#x80FD;&#xFF0C;&#x5728;&#x53D8;&#x91CF;&#x66FF;&#x6362;&#x4E4B;&#x524D;&#x8BF7;&#x6C42; URI &#x6A21;&#x677F;&#xFF08;&#x4F8B;&#x5982;&#xFF0C;<code>/api/person/{id}</code>&#xFF09;</td>
</tr>
</tbody>
</table>
<p>&#x8981;&#x81EA;&#x5B9A;&#x4E49;&#x6807;&#x7B7E;&#xFF0C;&#x8BF7;&#x63D0;&#x4F9B;&#x4E00;&#x4E2A;&#x5B9E;&#x73B0;&#x4E86; <code>JerseyTagsProvider</code> &#x7684; <code>@Bean</code>&#x3002;</p>
<p><a id="production-ready-metrics-http-clients"></a></p>
<h4 id="5734&#x3001;http-client-&#x6307;&#x6807;">57.3.4&#x3001;HTTP Client &#x6307;&#x6807;</h4>
<p>Spring Boot Actuator &#x7BA1;&#x7406; RestTemplate &#x548C; WebClient &#x7684;&#x6307;&#x6807;&#x8BB0;&#x5F55;&#x3002;&#x4E3A;&#x6B64;&#xFF0C;&#x4F60;&#x5FC5;&#x987B;&#x6CE8;&#x5165;&#x4E00;&#x4E2A;&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x7684; builder &#x5E76;&#x4F7F;&#x7528;&#x5B83;&#x6765;&#x521B;&#x5EFA;&#x5B9E;&#x4F8B;&#xFF1A;</p>
<ul>
<li><code>RestTemplateBuilder</code> &#x7528;&#x4E8E; <code>RestTemplate</code></li>
<li><code>WebClient.Builder</code> &#x7528;&#x4E8E; <code>WebClient</code></li>
</ul>
<p>&#x4E5F;&#x53EF;&#x4EE5;&#x624B;&#x52A8;&#x6307;&#x5B9A;&#x8D1F;&#x8D23;&#x6B64;&#x6307;&#x6807;&#x8BB0;&#x5F55;&#x7684;&#x81EA;&#x5B9A;&#x4E49;&#x7A0B;&#x5E8F;&#xFF0C;&#x5373; <code>MetricsRestTemplateCustomizer</code> &#x548C; <code>MetricsWebClientCustomizer</code>&#x3002;</p>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x4F7F;&#x7528;&#x540D;&#x4E3A; <code>http.client.requests</code> &#x751F;&#x6210;&#x5EA6;&#x91CF;&#x6307;&#x6807;&#x3002;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8BBE;&#x7F6E; <code>management.metrics.web.client.requests-metric-name</code> &#x5C5E;&#x6027;&#x6765;&#x81EA;&#x5B9A;&#x4E49;&#x540D;&#x79F0;&#x3002;</p>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x5DF2;&#x6307;&#x6807;&#x8BB0;&#x5F55;&#x5BA2;&#x6237;&#x7AEF;&#x751F;&#x6210;&#x7684;&#x5EA6;&#x91CF;&#x6307;&#x6807;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x6807;&#x7B7E;&#x6807;&#x8BB0;&#xFF1A;</p>
<ul>
<li><code>method</code>&#xFF0C;&#x8BF7;&#x6C42;&#x7684;&#x65B9;&#x6CD5;&#xFF08;&#x4F8B;&#x5982;&#xFF0C;<code>GET</code>&#x6216; <code>POST</code>&#xFF09;&#x3002;</li>
<li><code>uri</code>&#xFF0C;&#x53D8;&#x91CF;&#x66FF;&#x6362;&#x4E4B;&#x524D;&#x7684;&#x8BF7;&#x6C42; URI &#x6A21;&#x677F;&#xFF08;&#x5982;&#x679C;&#x53EF;&#x80FD;&#xFF09;&#xFF08;&#x4F8B;&#x5982;&#xFF0C;<code>/api/person/{id}</code>&#xFF09;&#x3002;</li>
<li><code>status</code>&#xFF0C;&#x54CD;&#x5E94;&#x7684; HTTP &#x72B6;&#x6001;&#x7801;&#xFF08;&#x4F8B;&#x5982;&#xFF0C;<code>200</code> &#x6216; <code>500</code>&#xFF09;&#x3002;</li>
<li><code>clientName</code>&#xFF0C;URI &#x7684;&#x4E3B;&#x673A;&#x90E8;&#x5206; &#x3002;</li>
</ul>
<p>&#x8981;&#x6839;&#x636E;&#x4F60;&#x9009;&#x62E9;&#x7684;&#x5BA2;&#x6237;&#x7AEF;&#x81EA;&#x5B9A;&#x4E49;&#x6807;&#x7B7E;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x63D0;&#x4F9B;&#x4E00;&#x4E2A;&#x5B9E;&#x73B0;&#x4E86; <code>RestTemplateExchangeTagsProvider</code> &#x6216; <code>WebClientExchangeTagsProvider</code> &#x7684; <code>@Bean</code>&#x3002;<code>RestTemplateExchangeTags</code> &#x548C; <code>WebClientExchangeTags</code> &#x4E2D;&#x6709;&#x4FBF;&#x6377;&#x7684;&#x9759;&#x6001;&#x51FD;&#x6570;&#x3002;</p>
<p><a id="production-ready-metrics-cache"></a></p>
<h4 id="5735&#x3001;cache-&#x6307;&#x6807;">57.3.5&#x3001;Cache &#x6307;&#x6807;</h4>
<p>&#x5728;&#x542F;&#x52A8;&#x65F6;&#xFF0C;&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x542F;&#x52A8;&#x6240;&#x6709;&#x53EF;&#x7528; <code>Cache</code> &#x7684;&#x6307;&#x6807;&#x8BB0;&#x5F55;&#x529F;&#x80FD;&#xFF0C;&#x6307;&#x6807;&#x4EE5; <code>cache</code> &#x4E3A;&#x524D;&#x7F00;&#x3002;&#x7F13;&#x5B58;&#x6307;&#x6807;&#x8BB0;&#x5F55;&#x9488;&#x5BF9;&#x4E00;&#x7EC4;&#x57FA;&#x672C;&#x6307;&#x6807;&#x8FDB;&#x884C;&#x4E86;&#x6807;&#x51C6;&#x5316;&#x3002;&#x6B64;&#x5916;&#xFF0C;&#x8FD8;&#x63D0;&#x4F9B;&#x4E86;&#x7F13;&#x5B58;&#x7279;&#x5B9A;&#x7684;&#x6307;&#x6807;&#x3002;</p>
<p>&#x652F;&#x6301;&#x4EE5;&#x4E0B;&#x7F13;&#x5B58;&#x5E93;&#xFF1A;</p>
<ul>
<li>Caffeine</li>
<li>EhCache 2</li>
<li>Hazelcast</li>
<li>&#x6240;&#x6709;&#x517C;&#x5BB9; JCache&#xFF08;JSR-107&#xFF09;&#x7684;&#x5B9E;&#x73B0;</li>
</ul>
<p>&#x5EA6;&#x91CF;&#x6307;&#x6807;&#x7531;&#x7F13;&#x5B58;&#x7684;&#x540D;&#x79F0;&#x548C;&#x4ECE; bean &#x540D;&#x79F0;&#x6D3E;&#x751F;&#x7684; <code>CacheManager</code> &#x7684;&#x540D;&#x79F0;&#x6807;&#x8BB0;&#x3002;</p>
<p><strong>&#x6CE8;&#x610F;</strong></p>
<blockquote>
<p>&#x53EA;&#x6709;&#x542F;&#x52A8;&#x65F6;&#x53EF;&#x7528;&#x7684;&#x7F13;&#x5B58;&#x624D;&#x4F1A;&#x7ED1;&#x5B9A;&#x5230;&#x6CE8;&#x518C;&#x8868;&#x3002;&#x5BF9;&#x4E8E;&#x5728;&#x542F;&#x52A8;&#x9636;&#x6BB5;&#x4E4B;&#x540E;&#x5373;&#x65F6;&#x6216;&#x4EE5;&#x7F16;&#x7A0B;&#x65B9;&#x5F0F;&#x521B;&#x5EFA;&#x7684;&#x7F13;&#x5B58;&#xFF0C;&#x9700;&#x8981;&#x663E;&#x5F0F;&#x6CE8;&#x518C;&#x3002;&#x53EF;&#x7528; <code>CacheMetricsRegistrar</code> bean &#x7B80;&#x5316;&#x8BE5;&#x8FC7;&#x7A0B;&#x3002;</p>
</blockquote>
<p><a id="production-ready-metrics-jdbc"></a></p>
<h4 id="5736&#x3001;&#x6570;&#x636E;&#x6E90;&#x6307;&#x6807;">57.3.6&#x3001;&#x6570;&#x636E;&#x6E90;&#x6307;&#x6807;</h4>
<p>&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x542F;&#x7528;&#x5BF9;&#x6240;&#x6709;&#x53EF;&#x7528; <code>DataSource</code> &#x5BF9;&#x8C61;&#x8FDB;&#x884C;&#x6307;&#x6807;&#x8BB0;&#x5F55;&#x529F;&#x80FD;&#xFF0C;&#x6307;&#x6807;&#x7684;&#x540D;&#x79F0;&#x4E3A; <code>jdbc</code>&#x3002;&#x6570;&#x636E;&#x6E90;&#x6307;&#x6807;&#x8BB0;&#x5F55;&#x4F1A;&#x751F;&#x6210;&#x8868;&#x793A;&#x6C60;&#x4E2D;&#x5F53;&#x524D;&#x6D3B;&#x52A8;&#x3001;&#x5927;&#x5141;&#x8BB8;&#x548C;&#x6700;&#x5C0F;&#x5141;&#x8BB8;&#x8FDE;&#x63A5;&#x7684;&#x8BA1;&#x91CF;&#x5668;&#xFF08;gauge&#xFF09;&#x3002;&#x8FD9;&#x4E9B;&#x8BA1;&#x91CF;&#x5668;&#x90FD;&#x6709;&#x4E00;&#x4E2A;&#x4EE5; <code>jdbc</code> &#x4E3A;&#x524D;&#x7F00;&#x7684;&#x540D;&#x79F0;&#x3002;</p>
<p>&#x5EA6;&#x91CF;&#x6307;&#x6807;&#x4E5F;&#x7531;&#x57FA;&#x4E8E; bean &#x540D;&#x79F0;&#x8BA1;&#x7B97;&#x7684; <code>DataSource</code> &#x7684;&#x540D;&#x79F0;&#x6807;&#x8BB0;&#x3002;</p>
<p><strong>&#x63D0;&#x793A;</strong></p>
<blockquote>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;Spring Boot &#x4E3A;&#x6240;&#x6709;&#x652F;&#x6301;&#x7684;&#x6570;&#x636E;&#x6E90;&#x63D0;&#x4F9B;&#x4E86;&#x5143;&#x6570;&#x636E;&#x3002;&#x5982;&#x679C;&#x5F00;&#x7BB1;&#x5373;&#x7528;&#x4E0D;&#x652F;&#x6301;&#x4F60;&#x559C;&#x6B22;&#x7684;&#x6570;&#x636E;&#x6E90;&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x6DFB;&#x52A0;&#x5176;&#x4ED6; <code>DataSourcePoolMetadataProvider</code> bean&#x3002;&#x6709;&#x5173;&#x793A;&#x4F8B;&#xFF0C;&#x8BF7;&#x53C2;&#x9605; <code>DataSourcePoolMetadataProvidersConfiguration</code>&#x3002;</p>
</blockquote>
<p>&#x6B64;&#x5916;&#xFF0C;Hikari &#x7279;&#x5B9A;&#x7684;&#x6307;&#x6807;&#x7528; <code>hikaricp</code> &#x524D;&#x7F00;&#x66B4;&#x9732;&#x3002;&#x6BCF;&#x4E2A;&#x5EA6;&#x91CF;&#x6307;&#x6807;&#x90FD;&#x7531;&#x6C60;&#x540D;&#x79F0;&#x6807;&#x8BB0;&#xFF08;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>spring.datasource.name</code> &#x63A7;&#x5236;&#xFF09;&#x3002;</p>
<p><a id="production-ready-metrics-hibernate"></a></p>
<h4 id="5737&#x3001;hibernate-&#x6307;&#x6807;">57.3.7&#x3001;Hibernate &#x6307;&#x6807;</h4>
<p>&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x542F;&#x7528;&#x6240;&#x6709;&#x53EF;&#x7528; Hibernate <code>EntityManagerFactory</code> &#x5B9E;&#x4F8B;&#x7684;&#x6307;&#x6807;&#x8BB0;&#x5F55;&#x529F;&#x80FD;&#xFF0C;&#x8FD9;&#x4E9B;&#x5B9E;&#x4F8B;&#x4F7F;&#x7528;&#x540D;&#x4E3A; <code>hibernate</code> &#x7684;&#x5EA6;&#x91CF;&#x6307;&#x6807;&#x7EDF;&#x8BA1;&#x4FE1;&#x606F;&#x3002;</p>
<p>&#x5EA6;&#x91CF;&#x6307;&#x6807;&#x4E5F;&#x7531;&#x4ECE; bean &#x540D;&#x79F0;&#x6D3E;&#x751F;&#x7684; <code>EntityManagerFactory</code> &#x7684;&#x540D;&#x79F0;&#x6807;&#x8BB0;&#x3002;</p>
<p>&#x8981;&#x542F;&#x7528;&#x4FE1;&#x606F;&#x7EDF;&#x8BA1;&#xFF0C;&#x5FC5;&#x987B;&#x5C06;&#x6807;&#x51C6; JPA &#x5C5E;&#x6027; <code>hibernate.generate_statistics</code> &#x8BBE;&#x7F6E;&#x4E3A; <code>true</code>&#x3002;&#x4F60;&#x53EF;&#x4EE5;&#x5728;&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x7684; <code>EntityManagerFactory</code> &#x4E0A;&#x542F;&#x7528;&#x5B83;&#xFF0C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">spring.jpa.properties.hibernate.generate_statistics</span><span class="token attr-value"><span class="token punctuation">=</span>true</span>
</code></pre>
<p><a id="production-ready-metrics-rabbitmq"></a></p>
<h4 id="5738&#x3001;rabbitmq-&#x6307;&#x6807;">57.3.8&#x3001;RabbitMQ &#x6307;&#x6807;</h4>
<p>&#x81EA;&#x52A8;&#x914D;&#x7F6E;&#x5C06;&#x4F7F;&#x7528;&#x540D;&#x4E3A; <code>rabbitmq</code> &#x7684;&#x5EA6;&#x91CF;&#x6307;&#x6807;&#x542F;&#x7528;&#x5BF9;&#x6240;&#x6709;&#x53EF;&#x7528; RabbitMQ &#x8FDE;&#x63A5;&#x5DE5;&#x5382;&#x8FDB;&#x884C;&#x6307;&#x6807;&#x8BB0;&#x5F55;&#x3002;</p>
<p><a id="production-ready-metrics-custom"></a></p>
<h3 id="574&#x3001;&#x6CE8;&#x518C;&#x81EA;&#x5B9A;&#x4E49;&#x6307;&#x6807;">57.4&#x3001;&#x6CE8;&#x518C;&#x81EA;&#x5B9A;&#x4E49;&#x6307;&#x6807;</h3>
<p>&#x8981;&#x6CE8;&#x518C;&#x81EA;&#x5B9A;&#x4E49;&#x6307;&#x6807;&#xFF0C;&#x8BF7;&#x5C06; <code>MeterRegistry</code> &#x6CE8;&#x5165;&#x4F60;&#x7684;&#x7EC4;&#x4EF6;&#x4E2D;&#xFF0C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#xFF1A;</p>
<pre class="language-"><code class="lang-java"><span class="token keyword">class</span> <span class="token class-name">Dictionary</span> <span class="token punctuation">{</span>

    <span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">List</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">&gt;</span></span> words <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">CopyOnWriteArrayList</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token class-name">Dictionary</span><span class="token punctuation">(</span><span class="token class-name">MeterRegistry</span> registry<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        registry<span class="token punctuation">.</span><span class="token function">gaugeCollectionSize</span><span class="token punctuation">(</span><span class="token string">&quot;dictionary.size&quot;</span><span class="token punctuation">,</span> <span class="token class-name">Tags</span><span class="token punctuation">.</span><span class="token function">empty</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">this</span><span class="token punctuation">.</span>words<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token comment">// &#x2026;</span>

<span class="token punctuation">}</span>
</code></pre>
<p>&#x5982;&#x679C;&#x4F60;&#x53D1;&#x73B0;&#x8DE8;&#x7EC4;&#x4EF6;&#x6216;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x91CD;&#x590D;&#x8BB0;&#x5F55;&#x4E00;&#x5957;&#x5EA6;&#x91CF;&#x6307;&#x6807;&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x5C06;&#x6B64;&#x5957;&#x4EF6;&#x5C01;&#x88C5;&#x5728; <code>MeterBinder</code> &#x5B9E;&#x73B0;&#x4E2D;&#x3002;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x6240;&#x6709; <code>MeterBinder</code> bean &#x7684;&#x6307;&#x6807;&#x90FD;&#x5C06;&#x81EA;&#x52A8;&#x7ED1;&#x5B9A;&#x5230; Spring &#x7BA1;&#x7406;&#x7684; <code>MeterRegistry</code>&#x3002;</p>
<p><a id="production-ready-metrics-per-meter-properties"></a></p>
<h3 id="575&#x3001;&#x81EA;&#x5B9A;&#x4E49;&#x5355;&#x72EC;&#x6307;&#x6807;">57.5&#x3001;&#x81EA;&#x5B9A;&#x4E49;&#x5355;&#x72EC;&#x6307;&#x6807;</h3>
<p>&#x5982;&#x679C;&#x9700;&#x8981;&#x5C06;&#x81EA;&#x5B9A;&#x4E49;&#x7279;&#x5B9A;&#x7684; <code>Meter</code> &#x5B9E;&#x4F8B;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>io.micrometer.core.instrument.config.MeterFilter</code> &#x63A5;&#x53E3;&#x3002;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x6240;&#x6709; <code>MeterFilter</code> bean &#x90FD;&#x5C06;&#x81EA;&#x52A8;&#x5E94;&#x7528;&#x4E8E; <code>MeterRegistry.Config</code>&#x3002;</p>
<p>&#x4F8B;&#x5982;&#xFF0C;&#x5982;&#x679C;&#x8981;&#x5C06; <code>mytag.region</code> &#x6807;&#x8BB0;&#x91CD;&#x547D;&#x540D;&#x4E3A; <code>mytag.area</code> &#x4EE5;&#x83B7;&#x53D6;&#x4EE5; <code>com.example</code> &#x5F00;&#x5934;&#x7684;&#x6240;&#x6709; meter ID&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x6267;&#x884C;&#x4EE5;&#x4E0B;&#x64CD;&#x4F5C;&#xFF1A;</p>
<pre class="language-"><code class="lang-java"><span class="token annotation punctuation">@Bean</span>
<span class="token keyword">public</span> <span class="token class-name">MeterFilter</span> <span class="token function">renameRegionTagMeterFilter</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token class-name">MeterFilter</span><span class="token punctuation">.</span><span class="token function">renameTag</span><span class="token punctuation">(</span><span class="token string">&quot;com.example&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;mytag.region&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;mytag.area&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p><a id="production-ready-metrics-common-tags"></a></p>
<h4 id="5751&#x3001;&#x81EA;&#x5B9A;&#x4E49;&#x6807;&#x7B7E;">57.5.1&#x3001;&#x81EA;&#x5B9A;&#x4E49;&#x6807;&#x7B7E;</h4>
<p>&#x901A;&#x7528;&#x6807;&#x7B7E;&#x901A;&#x5E38;&#x7528;&#x4E8E;&#x64CD;&#x4F5C;&#x73AF;&#x5883;&#x4E2D;&#x7684;&#x7EF4;&#x5EA6;&#x4E0B;&#x94BB;&#xFF0C;&#x4F8B;&#x5982;&#x4E3B;&#x673A;&#x3001;&#x5B9E;&#x4F8B;&#x3001;&#x533A;&#x57DF;&#x3001;&#x5806;&#x6808;&#x7B49;&#x3002;&#x901A;&#x7528;&#x6807;&#x7B7E;&#x5E94;&#x7528;&#x4E8E;&#x6240;&#x6709; meter&#xFF0C;&#x5E76;&#x4E14;&#x53EF;&#x4EE5;&#x6309;&#x7167;&#x4EE5;&#x4E0B;&#x793A;&#x4F8B;&#x8FDB;&#x884C;&#x914D;&#x7F6E;&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.tags.region</span><span class="token attr-value"><span class="token punctuation">=</span>us-east-1</span>
<span class="token constant">management.metrics.tags.stack</span><span class="token attr-value"><span class="token punctuation">=</span>prod</span>
</code></pre>
<p>&#x4E0A;&#x9762;&#x7684;&#x793A;&#x4F8B;&#x5C06; <code>region</code> &#x548C; <code>stack</code> &#x6807;&#x7B7E;&#x6DFB;&#x52A0;&#x5230;&#x6240;&#x6709; meter &#x4E2D;&#xFF0C;&#x5176;&#x503C;&#x5206;&#x522B;&#x4E3A; <code>us-east-1</code> &#x548C; <code>prod</code>&#x3002;</p>
<p><strong>&#x6CE8;&#x610F;</strong></p>
<blockquote>
<p>&#x5982;&#x679C;&#x4F60;&#x4F7F;&#x7528; Graphite&#xFF0C;&#x90A3;&#x4E48;&#x6807;&#x7B7E;&#x7684;&#x987A;&#x5E8F;&#x5F88;&#x91CD;&#x8981;&#x3002;&#x7531;&#x4E8E;&#x4F7F;&#x7528;&#x6B64;&#x65B9;&#x6CD5;&#x65E0;&#x6CD5;&#x4FDD;&#x8BC1;&#x901A;&#x7528;&#x6807;&#x7B7E;&#x7684;&#x987A;&#x5E8F;&#xFF0C;&#x56E0;&#x6B64;&#x5EFA;&#x8BAE; Graphite &#x7528;&#x6237;&#x5B9A;&#x4E49;&#x81EA;&#x5B9A;&#x4E49; <code>MeterFilter</code>&#x3002;</p>
</blockquote>
<p><a id="_per_meter_properties"></a></p>
<h4 id="5752&#x3001;per-meter-&#x5C5E;&#x6027;">57.5.2&#x3001;Per-meter &#x5C5E;&#x6027;</h4>
<p>&#x9664;&#x4E86; <code>MeterFilter</code> bean &#x4E4B;&#x5916;&#xFF0C;&#x8FD8;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; properties &#x5728; per-meter &#x57FA;&#x7840;&#x4E0A;&#x81EA;&#x5B9A;&#x4E49;&#x3002;Per-meter &#x5B9A;&#x4E49;&#x9002;&#x7528;&#x4E8E;&#x4EE5;&#x7ED9;&#x5B9A;&#x540D;&#x79F0;&#x5F00;&#x5934;&#x7684;&#x6240;&#x6709; meter ID&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x4EE5;&#x4E0B;&#x5C06;&#x7981;&#x7528;&#x4EFB;&#x4F55;&#x4EE5; <code>example.remote</code> &#x5F00;&#x5934;&#x7684; ID &#x7684; meter&#xFF1A;</p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.metrics.enable.example.remote</span><span class="token attr-value"><span class="token punctuation">=</span>false</span>
</code></pre>
<p>&#x4EE5;&#x4E0B;&#x5C5E;&#x6027;&#x5141;&#x8BB8; per-meter &#x81EA;&#x5B9A;&#x4E49;&#xFF1A;</p>
<p><strong>&#x8868; 57.1&#x3001;Per-meter &#x81EA;&#x5B9A;&#x4E49;</strong></p>
<p>| &#x5C5E;&#x6027; | &#x63CF;&#x8FF0; |
| <code>management.metrics.enable</code> | &#x662F;&#x5426;&#x62D2;&#x7EDD; meter &#x53D1;&#x5E03;&#x4EFB;&#x4F55;&#x6307;&#x6807;&#x3002; |
| <code>management.metrics.distribution.percentiles-histogram</code> | &#x662F;&#x5426;&#x53D1;&#x5E03;&#x4E00;&#x4E2A;&#x9002;&#x7528;&#x4E8E;&#x8BA1;&#x7B97;&#x53EF;&#x805A;&#x5408;&#xFF08;&#x8DE8;&#x7EF4;&#x5EA6;&#xFF09;&#x7684;&#x767E;&#x5206;&#x6BD4;&#x8FD1;&#x4F3C;&#x67F1;&#x72B6;&#x56FE;&#x3002; |
| <code>management.metrics.distribution.minimum-expected-value</code>&#xFF0C;<br> <code>management.metrics.distribution.maximum-expected-value</code>| &#x901A;&#x8FC7;&#x9650;&#x5236;&#x9884;&#x671F;&#x503C;&#x7684;&#x8303;&#x56F4;&#x6765;&#x53D1;&#x5E03;&#x8F83;&#x5C11;&#x7684;&#x67F1;&#x72B6;&#x56FE;&#x6876;&#x3002; |
| <code>management.metrics.distribution.percentiles</code> | &#x53D1;&#x5E03;&#x5728;&#x4F60;&#x81EA;&#x5DF1;&#x7684;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4E2D;&#x8BA1;&#x7B97;&#x7684;&#x767E;&#x5206;&#x6BD4;&#x6570;&#x503C; |
| <code>management.metrics.distribution.sla</code> | &#x53D1;&#x4E00;&#x4E2A;&#x4F7F;&#x7528; SLA &#x5B9A;&#x4E49;&#x7684;&#x5B58;&#x50A8;&#x6876;&#x53D1;&#x5E03;&#x7D2F;&#x79EF;&#x67F1;&#x72B6;&#x56FE;&#x3002; |</p>
<p>&#x6709;&#x5173; <code>percentiles-histogram</code>&#x3001;<code>percentiles</code> &#x548C; <code>sla</code> &#x6982;&#x5FF5;&#x7684;&#x66F4;&#x591A;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#xFF0C;&#x8BF7;&#x53C2;&#x9605;&#x300C;<a href="https://micrometer.io/docs/concepts#_histograms_and_percentiles" target="_blank">&#x67F1;&#x72B6;&#x56FE;&#x4E0E;&#x767E;&#x5206;&#x4F4D;&#x6570;</a>&#x300D;&#x90E8;&#x5206;&#x7684;&#x6587;&#x6863;&#x3002;</p>
<p><a id="production-ready-metrics-endpoint"></a></p>
<h3 id="576&#x3001;&#x6307;&#x6807;&#x7AEF;&#x70B9;">57.6&#x3001;&#x6307;&#x6807;&#x7AEF;&#x70B9;</h3>
<p>Spring Boot &#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x4E2A; <code>metrics</code> &#x7AEF;&#x70B9;&#xFF0C;&#x53EF;&#x4EE5;&#x5728;&#x8BCA;&#x65AD;&#x4E2D;&#x7528;&#x4E8E;&#x68C0;&#x67E5;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x6536;&#x96C6;&#x7684;&#x5EA6;&#x91CF;&#x6307;&#x6807;&#x3002;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#x7AEF;&#x70B9;&#x4E0D;&#x53EF;&#x7528;&#xFF0C;&#x5FC5;&#x987B;&#x624B;&#x52A8;&#x66B4;&#x9732;&#xFF0C;&#x8BF7;&#x53C2;&#x9605;<a href="#production-ready-endpoints-exposing-endpoints">&#x66B4;&#x9732;&#x7AEF;&#x70B9;</a>&#x4EE5;&#x83B7;&#x53D6;&#x66F4;&#x591A;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#x3002;</p>
<p>&#x8BBF;&#x95EE; <code>/actuator/metrics</code> &#x4F1A;&#x663E;&#x793A;&#x53EF;&#x7528;&#x7684; meter &#x540D;&#x79F0;&#x5217;&#x8868;&#x3002;&#x4F60;&#x53EF;&#x4EE5;&#x67E5;&#x770B;&#x67D0;&#x4E00;&#x4E2A; meter &#x7684;&#x4FE1;&#x606F;&#xFF0C;&#x65B9;&#x6CD5;&#x662F;&#x5C06;&#x5176;&#x540D;&#x79F0;&#x4F5C;&#x4E3A;&#x9009;&#x62E9;&#x5668;&#xFF0C;&#x4F8B;&#x5982;&#xFF0C;<code>/actuator/metrics/jvm.memory.max</code>&#x3002;</p>
<p><strong>&#x63D0;&#x793A;</strong></p>
<blockquote>
<p>&#x4F60;&#x5728;&#x6B64;&#x5904;&#x4F7F;&#x7528;&#x7684;&#x540D;&#x79F0;&#x5E94;&#x4E0E;&#x4EE3;&#x7801;&#x4E2D;&#x4F7F;&#x7528;&#x7684;&#x540D;&#x79F0;&#x76F8;&#x5339;&#x914D;&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x5728;&#x547D;&#x540D;&#x7EA6;&#x5B9A;&#x89C4;&#x8303;&#x5316;&#x540E;&#x7684;&#x540D;&#x79F0; &#x2014;&#x2014; &#x4E3A;&#x4E86;&#x53D1;&#x9001;&#x5230;&#x76D1;&#x63A7;&#x7CFB;&#x7EDF;&#x3002;&#x6362;&#x53E5;&#x8BDD;&#x8BF4;&#xFF0C;&#x5982;&#x679C; <code>jvm.memory.max</code> &#x7531;&#x4E8E; Prometheus &#x547D;&#x540D;&#x7EA6;&#x5B9A;&#x800C;&#x663E;&#x793A;&#x4E3A; <code>jvm_memory_max</code>&#xFF0C;&#x5219;&#x5728;&#x5BA1;&#x67E5;&#x5EA6;&#x91CF;&#x6307;&#x6807;&#x7AEF;&#x70B9;&#x4E2D;&#x7684; meter &#x65F6;&#xFF0C;&#x5E94;&#x4ECD;&#x4F7F;&#x7528; <code>jvm.memory.max</code> &#x4F5C;&#x4E3A;&#x9009;&#x62E9;&#x5668;&#x3002;</p>
</blockquote>
<p>&#x4F60;&#x8FD8;&#x53EF;&#x4EE5;&#x5728; URL &#x7684;&#x672B;&#x5C3E;&#x6DFB;&#x52A0;&#x4EFB;&#x610F;&#x6570;&#x91CF;&#x7684; <code>tag=KEY:VALUE</code> &#x67E5;&#x8BE2;&#x53C2;&#x6570;&#xFF0C;&#x4EE5;&#x4FBF;&#x591A;&#x7EF4;&#x5EA6;&#x5411;&#x4E0B;&#x94BB;&#x53D6; meter&#xFF0C;&#x4F8B;&#x5982; <code>/actuator/metrics/jvm.memory.max?tag=area:nonheap</code>&#x3002;</p>
<p><strong>&#x63D0;&#x793A;</strong></p>
<p>&#x62A5;&#x544A;&#x7684;&#x6D4B;&#x91CF;&#x503C;&#x662F;&#x4E0E; meter &#x540D;&#x79F0;&#x548C;&#x5DF2;&#x5E94;&#x7528;&#x7684;&#x4EFB;&#x4F55;&#x6807;&#x7B7E;&#x5339;&#x914D;&#x7684;&#x6240;&#x6709; meter &#x7684;&#x7EDF;&#x8BA1;&#x6570;&#x636E;&#x7684;&#x603B;&#x548C;&#x3002;&#x56E0;&#x6B64;&#xFF0C;&#x5728;&#x4E0A;&#x9762;&#x7684;&#x793A;&#x4F8B;&#x4E2D;&#xFF0C;&#x8FD4;&#x56DE;&#x7684; Value &#x7EDF;&#x8BA1;&#x4FE1;&#x606F;&#x662F;&#x5806;&#x7684; Code Cache&#xFF0C;Compressed Class Space &#x548C; Metaspace &#x533A;&#x57DF;&#x7684;&#x6700;&#x5927;&#x5185;&#x5B58;&#x5360;&#x7528;&#x91CF;&#x7684;&#x603B;&#x548C;&#x3002;&#x5982;&#x679C;&#x4F60;&#x53EA;&#x60F3;&#x67E5;&#x770B; Metaspace &#x7684;&#x6700;&#x5927;&#x5927;&#x5C0F;&#xFF0C;&#x53EF;&#x4EE5;&#x6DFB;&#x52A0;&#x4E00;&#x4E2A;&#x989D;&#x5916;&#x7684; <code>tag=id:Metaspace</code>&#xFF0C;&#x5373; <code>/actuator/metrics/jvm.memory.max?tag=area:nonheap&amp;tag=id:Metaspace</code>&#x3002;</p>
<p><a id="production-ready-auditing"></a></p>
<h2 id="58&#x3001;&#x5BA1;&#x8BA1;">58&#x3001;&#x5BA1;&#x8BA1;</h2>
<p>&#x4E00;&#x65E6; Spring Security &#x751F;&#x6548;&#xFF0C;Spring Boot Actuator &#x5C31;&#x62E5;&#x6709;&#x4E00;&#x4E2A;&#x7075;&#x6D3B;&#x7684;&#x5BA1;&#x8BA1;&#x6846;&#x67B6;&#xFF0C;&#x5B83;&#x53EF;&#x4EE5;&#x53D1;&#x5E03;&#x4E8B;&#x4EF6;&#xFF08;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;<code>authentication success</code>&#x3001;<code>failure</code> &#x548C; <code>access denied</code> &#x4F8B;&#x5916;&#xFF09;&#x3002;&#x6B64;&#x529F;&#x80FD;&#x5BF9;&#x4E8B;&#x4EF6;&#x62A5;&#x544A;&#x548C;&#x57FA;&#x4E8E;&#x8EAB;&#x4EFD;&#x9A8C;&#x8BC1;&#x5931;&#x8D25;&#x5B9E;&#x73B0;&#x4E00;&#x4E2A;&#x9501;&#x5B9A;&#x7B56;&#x7565;&#x975E;&#x5E38;&#x6709;&#x7528;&#x3002;&#x8981;&#x81EA;&#x5B9A;&#x4E49;&#x53D1;&#x5E03;&#x7684;&#x5B89;&#x5168;&#x4E8B;&#x4EF6;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x63D0;&#x4F9B;&#x81EA;&#x5DF1;&#x7684; <code>AbstractAuthenticationAuditListener</code> &#x548C; <code>AbstractAuthorizationAuditListener</code> &#x5B9E;&#x73B0;&#x3002;</p>
<p>&#x4F60;&#x8FD8;&#x53EF;&#x4EE5;&#x5C06;&#x5BA1;&#x8BA1;&#x670D;&#x52A1;&#x7528;&#x4E8E;&#x81EA;&#x5DF1;&#x7684;&#x4E1A;&#x52A1;&#x4E8B;&#x4EF6;&#x3002;&#x4E3A;&#x6B64;&#xFF0C;&#x8BF7;&#x5C06;&#x73B0;&#x6709;&#x7684; <code>AuditEventRepository</code> &#x6CE8;&#x5165;&#x81EA;&#x5DF1;&#x7684;&#x7EC4;&#x4EF6;&#x5E76;&#x76F4;&#x63A5;&#x4F7F;&#x7528;&#x5B83;&#x6216;&#x4F7F;&#x7528; Spring <code>ApplicationEventPublisher</code>&#xFF08;&#x901A;&#x8FC7;&#x5B9E;&#x73B0; <code>ApplicationEventPublisherAware</code>&#xFF09;&#x53D1;&#x5E03; <code>AuditApplicationEvent</code>&#x3002;</p>
<p><a id="production-ready-http-tracing"></a></p>
<h2 id="59&#x3001;http-&#x8FFD;&#x8E2A;">59&#x3001;HTTP &#x8FFD;&#x8E2A;</h2>
<p>&#x6240;&#x6709; HTTP &#x8BF7;&#x6C42;&#x5C06;&#x81EA;&#x52A8;&#x542F;&#x7528;&#x8FFD;&#x8E2A;&#x529F;&#x80FD;&#x3002;&#x4F60;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x67E5;&#x770B; <code>httptrace</code> &#x7AEF;&#x70B9;&#x6765;&#x83B7;&#x53D6;&#x6700;&#x8FD1;&#x76F8;&#x5173;&#x7684; 100 &#x4E2A;&#x8BF7;&#x6C42;&#x54CD;&#x5E94;&#x4FE1;&#x606F;&#x3002;</p>
<p><a id="production-ready-http-tracing-custom"></a></p>
<h3 id="591&#x3001;&#x81EA;&#x5B9A;&#x4E49;-http-&#x8FFD;&#x8E2A;">59.1&#x3001;&#x81EA;&#x5B9A;&#x4E49; HTTP &#x8FFD;&#x8E2A;</h3>
<p>&#x8981;&#x81EA;&#x5B9A;&#x4E49;&#x6BCF;&#x4E2A;&#x8FFD;&#x8E2A;&#x4FE1;&#x606F;&#x4E2D;&#x5305;&#x542B;&#x7684;&#x9879;&#xFF0C;&#x8BF7;&#x4F7F;&#x7528; <code>management.trace.http.include</code> &#x5C5E;&#x6027;&#x914D;&#x7F6E;&#x3002;&#x5BF9;&#x4E8E;&#x9AD8;&#x7EA7;&#x81EA;&#x5B9A;&#x4E49;&#xFF0C;&#x8BF7;&#x8003;&#x8651;&#x6CE8;&#x518C;&#x81EA;&#x5DF1;&#x7684; <code>HttpExchangeTracer</code> &#x5B9E;&#x73B0;&#x3002;</p>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x4F7F;&#x7528;&#x4E00;&#x4E2A; <code>InMemoryHttpTraceRepository</code> &#x5B58;&#x50A8;&#x6700;&#x65B0;&#x7684; 100 &#x4E2A;&#x8BF7;&#x6C42;&#x54CD;&#x5E94;&#x4FE1;&#x606F;&#x3002;&#x5982;&#x679C;&#x9700;&#x8981;&#x6269;&#x5C55;&#x5BB9;&#x91CF;&#xFF0C;&#x53EF;&#x5B9A;&#x4E49;&#x81EA;&#x5DF1;&#x7684; <code>InMemoryHttpTraceRepository</code> bean &#x5B9E;&#x4F8B;&#x3002;&#x4F60;&#x8FD8;&#x53EF;&#x4EE5;&#x521B;&#x5EFA;&#x81EA;&#x5DF1;&#x7684; <code>HttpTraceRepository</code> &#x5B9E;&#x73B0;&#x6765;&#x66FF;&#x4EE3;&#x9ED8;&#x8BA4;&#x914D;&#x7F6E;&#x3002;</p>
<p><a id="production-ready-process-monitoring"></a></p>
<h2 id="60&#x3001;&#x8FDB;&#x7A0B;&#x76D1;&#x63A7;">60&#x3001;&#x8FDB;&#x7A0B;&#x76D1;&#x63A7;</h2>
<p>&#x5728; <code>spring-boot</code> &#x6A21;&#x5757;&#x4E2D;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x627E;&#x5230;&#x4E24;&#x4E2A;&#x7C7B;&#x6765;&#x521B;&#x5EFA;&#x6587;&#x4EF6;&#xFF0C;&#x4ED6;&#x4EEC;&#x901A;&#x5E38;&#x7528;&#x4E8E;&#x8FDB;&#x7A0B;&#x76D1;&#x63A7;&#xFF1A;</p>
<ul>
<li><code>ApplicationPidFileWriter</code> &#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x5305;&#x542B;&#x5E94;&#x7528;&#x7A0B;&#x5E8F; PID &#x7684;&#x6587;&#x4EF6;&#xFF08;&#x9ED8;&#x8BA4;&#x5728;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x76EE;&#x5F55;&#x4E2D;&#xFF0C;&#x6587;&#x4EF6;&#x540D;&#x4E3A; <code>application.pid</code>&#xFF09;&#x3002;</li>
<li><code>WebServerPortFileWriter</code> &#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x6216;&#x591A;&#x4E2A;&#x6587;&#x4EF6;&#xFF0C;&#x5176;&#x5305;&#x542B;&#x6B63;&#x5728;&#x8FD0;&#x884C;&#x7684; Web &#x670D;&#x52A1;&#x5668;&#x7684;&#x7AEF;&#x53E3;&#xFF08;&#x9ED8;&#x8BA4;&#x5728;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x76EE;&#x5F55;&#x4E2D;&#xFF0C;&#x6587;&#x4EF6;&#x540D;&#x4E3A; <code>application.port</code>&#xFF09;&#x3002;</li>
</ul>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x8FD9;&#x4E9B; writer &#x672A;&#x6FC0;&#x6D3B;&#xFF0C;&#x4F46;&#x4F60;&#x53EF;&#x4EE5;&#x542F;&#x7528;&#xFF1A;</p>
<ul>
<li><a href="#production-ready-process-monitoring-configuration">&#x6269;&#x5C55;&#x914D;&#x7F6E;</a></li>
<li><a href="#production-ready-process-monitoring-programmatically">&#x7B2C; 60.2 &#x8282;&#x3001;&#x7F16;&#x7A0B;&#x65B9;&#x5F0F;</a></li>
</ul>
<p><a id="production-ready-process-monitoring-configuration"></a></p>
<h3 id="601&#x3001;&#x6269;&#x5C55;&#x914D;&#x7F6E;">60.1&#x3001;&#x6269;&#x5C55;&#x914D;&#x7F6E;</h3>
<p>&#x4F60;&#x53EF;&#x4EE5;&#x5728; <code>META-INF/spring.factories</code> &#x6587;&#x4EF6;&#x4E2D;&#x6FC0;&#x6D3B;&#x751F;&#x6210;&#x548C;&#x5199;&#x5165; PID &#x6587;&#x4EF6;&#x7684;&#x76D1;&#x542C;&#x5668;&#xFF08;Listener&#xFF09;&#xFF0C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#xFF1A;</p>
<pre class="language-"><code>org.springframework.context.ApplicationListener=\
org.springframework.boot.context.ApplicationPidFileWriter,\
org.springframework.boot.web.context.WebServerPortFileWriter
</code></pre><p><a id="production-ready-process-monitoring-configuration"></a></p>
<h3 id="602&#x3001;&#x7F16;&#x7A0B;&#x65B9;&#x5F0F;">60.2&#x3001;&#x7F16;&#x7A0B;&#x65B9;&#x5F0F;</h3>
<p>&#x4F60;&#x8FD8;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8C03;&#x7528; <code>SpringApplication.addListeners(...)</code> &#x65B9;&#x6CD5;&#x5E76;&#x4F20;&#x9012;&#x76F8;&#x5E94;&#x7684; <code>Writer</code> &#x5BF9;&#x8C61;&#x6765;&#x6FC0;&#x6D3B;&#x76D1;&#x542C;&#x5668;&#x3002;&#x6B64;&#x65B9;&#x6CD5;&#x8FD8;&#x5141;&#x8BB8;&#x4F60;&#x5728; <code>Writer</code> &#x6784;&#x9020;&#x65B9;&#x6CD5;&#x4E2D;&#x81EA;&#x5B9A;&#x4E49;&#x6587;&#x4EF6;&#x540D;&#x548C;&#x8DEF;&#x5F84;&#x3002;</p>
<p><a id="production-ready-cloudfoundry"></a></p>
<h2 id="61&#x3001;cloud-foundry-&#x652F;&#x6301;">61&#x3001;Cloud Foundry &#x652F;&#x6301;</h2>
<p>&#x5F53;&#x4F60;&#x90E8;&#x7F72;&#x5230;&#x4E00;&#x4E2A;&#x517C;&#x5BB9; Cloud Foundry &#x7684;&#x5B9E;&#x4F8B;&#x65F6;&#xFF0C;Spring Boot &#x7684; Actuator &#x6A21;&#x5757;&#x5305;&#x542B;&#x7684;&#x5176;&#x4ED6;&#x652F;&#x6301;&#x5C06;&#x88AB;&#x6FC0;&#x6D3B;&#x3002;<code>/cloudfoundryapplication</code> &#x8DEF;&#x5F84;&#x4E3A;&#x6240;&#x6709; <code>@Endpoint</code> bean &#x63D0;&#x4F9B;&#x4E86;&#x53E6;&#x5916;&#x4E00;&#x4E2A;&#x5B89;&#x5168;&#x8DEF;&#x7531;&#x3002;</p>
<p>&#x8BE5;&#x6269;&#x5C55;&#x652F;&#x6301;&#x5141;&#x8BB8;&#x4F7F;&#x7528; Spring Boot Actuator &#x4FE1;&#x606F;&#x6269;&#x5145; Cloud Foundry &#x7BA1;&#x7406; UI&#xFF08;&#x4F8B;&#x5982;&#x53EF;&#x7528;&#x4E8E;&#x67E5;&#x770B;&#x5DF2;&#x90E8;&#x7F72;&#x5E94;&#x7528;&#x7684; Web &#x5E94;&#x7528;&#xFF09;&#x3002;&#x6BD4;&#x5982;&#xFF0C;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x72B6;&#x6001;&#x9875;&#x9762;&#x53EF;&#x4EE5;&#x5305;&#x62EC;&#x5B8C;&#x6574;&#x7684;&#x5065;&#x5EB7;&#x4FE1;&#x606F;&#x800C;&#x4E0D;&#x662F;&#x5E38;&#x89C1;&#x7684; running &#x6216; stop &#x72B6;&#x6001;&#x3002;</p>
<p><strong>&#x6CE8;&#x610F;</strong></p>
<blockquote>
<p>&#x5E38;&#x89C4;&#x7528;&#x6237;&#x65E0;&#x6CD5;&#x76F4;&#x63A5;&#x8BBF;&#x95EE; <code>/cloudfoundryapplication</code> &#x8DEF;&#x5F84;&#x3002;&#x4E3A;&#x4E86;&#x80FD;&#x8BBF;&#x95EE;&#x7AEF;&#x70B9;&#xFF0C;&#x4F60;&#x5FC5;&#x987B;&#x5728;&#x8BF7;&#x6C42;&#x65F6;&#x4F20;&#x9012;&#x4E00;&#x4E2A;&#x6709;&#x6548;&#x7684; UAA &#x4EE4;&#x724C;&#x3002;</p>
</blockquote>
<p><a id="production-ready-cloudfoundry-disable"></a></p>
<h3 id="611&#x3001;&#x7981;&#x7528;-cloud-foundry-actuator-&#x6269;&#x5C55;&#x652F;&#x6301;">61.1&#x3001;&#x7981;&#x7528; Cloud Foundry Actuator &#x6269;&#x5C55;&#x652F;&#x6301;</h3>
<p>&#x5982;&#x679C;&#x8981;&#x5B8C;&#x5168;&#x7981;&#x7528; <code>/cloudfoundryapplication</code> &#x7AEF;&#x70B9;&#xFF0C;&#x53EF;&#x4EE5;&#x5C06;&#x4EE5;&#x4E0B;&#x8BBE;&#x7F6E;&#x6DFB;&#x52A0;&#x5230; <code>application.properties</code> &#x6587;&#x4EF6;&#x4E2D;&#xFF1A;</p>
<p><strong>application.properties</strong></p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.cloudfoundry.enabled</span><span class="token attr-value"><span class="token punctuation">=</span>false</span>
</code></pre>
<p><a id="production-ready-cloudfoundry-ssl"></a></p>
<h3 id="612&#x3001;cloud-foundry-&#x81EA;&#x7B7E;&#x540D;&#x8BC1;&#x4E66;">61.2&#x3001;Cloud Foundry &#x81EA;&#x7B7E;&#x540D;&#x8BC1;&#x4E66;</h3>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;<code>/cloudfoundryapplication</code> &#x7AEF;&#x70B9;&#x7684;&#x5B89;&#x5168;&#x9A8C;&#x8BC1;&#x4F1A;&#x5BF9;&#x5404;&#x79CD; Cloud Foundry &#x670D;&#x52A1;&#x8FDB;&#x884C; SSL &#x8C03;&#x7528;&#x3002;&#x5982;&#x679C;&#x4F60;&#x7684; Cloud Foundry UAA &#x6216; Cloud Controller &#x670D;&#x52A1;&#x4F7F;&#x7528;&#x81EA;&#x7B7E;&#x540D;&#x8BC1;&#x4E66;&#xFF0C;&#x5219;&#x9700;&#x8981;&#x8BBE;&#x7F6E;&#x4EE5;&#x4E0B;&#x5C5E;&#x6027;&#xFF1A;</p>
<p><strong>application.properties</strong></p>
<pre class="language-"><code class="lang-ini"><span class="token constant">management.cloudfoundry.skip-ssl-validation</span><span class="token attr-value"><span class="token punctuation">=</span>true</span>
</code></pre>
<p><a id="_custom_context_path"></a></p>
<h3 id="613&#x3001;&#x81EA;&#x5B9A;&#x4E49;&#x4E0A;&#x4E0B;&#x6587;&#x8DEF;&#x5F84;">61.3&#x3001;&#x81EA;&#x5B9A;&#x4E49;&#x4E0A;&#x4E0B;&#x6587;&#x8DEF;&#x5F84;</h3>
<p>&#x5982;&#x679C;&#x670D;&#x52A1;&#x5668;&#x7684; context-path &#x5DF2;&#x914D;&#x7F6E;&#x4E3A; <code>/</code> &#x4EE5;&#x5916;&#x7684;&#x5176;&#x4ED6;&#x5185;&#x5BB9;&#xFF0C;&#x5219; Cloud Foundry &#x7AEF;&#x70B9;&#x5C06;&#x65E0;&#x6CD5;&#x5728;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x7684;&#x6839;&#x76EE;&#x5F55;&#x4E2D;&#x4F7F;&#x7528;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x5982;&#x679C; <code>server.servlet.context-path=/app</code>&#xFF0C;Cloud Foundry &#x7AEF;&#x70B9;&#x5C06;&#x5728; <code>/app/cloudfoundryapplication/*</code> &#x4E0A;&#x53EF;&#x7528;&#x3002;</p>
<p>&#x5982;&#x679C;&#x4F60;&#x5E0C;&#x671B; Cloud Foundry &#x7AEF;&#x70B9;&#x59CB;&#x7EC8;&#x5728; <code>/cloudfoundryapplication/*</code> &#x4E0A;&#x53EF;&#x7528;&#xFF0C;&#x5219;&#x65E0;&#x8BBA;&#x670D;&#x52A1;&#x5668;&#x7684; context-path &#x5982;&#x4F55;&#xFF0C;&#x4F60;&#x90FD;&#x9700;&#x8981;&#x5728;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4E2D;&#x660E;&#x786E;&#x914D;&#x7F6E;&#x5B83;&#x3002;&#x914D;&#x7F6E;&#x56E0;&#x4F7F;&#x7528;&#x7684; Web &#x670D;&#x52A1;&#x5668;&#x800C;&#x6709;&#x6240;&#x4E0D;&#x540C;&#x3002;&#x9488;&#x5BF9; Tomcat&#xFF0C;&#x53EF;&#x4EE5;&#x6DFB;&#x52A0;&#x4EE5;&#x4E0B;&#x914D;&#x7F6E;&#xFF1A;</p>
<pre class="language-"><code class="lang-java"><span class="token annotation punctuation">@Bean</span>
<span class="token keyword">public</span> <span class="token class-name">TomcatServletWebServerFactory</span> <span class="token function">servletWebServerFactory</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token keyword">new</span> <span class="token class-name">TomcatServletWebServerFactory</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>

        <span class="token annotation punctuation">@Override</span>
        <span class="token keyword">protected</span> <span class="token keyword">void</span> <span class="token function">prepareContext</span><span class="token punctuation">(</span><span class="token class-name">Host</span> host<span class="token punctuation">,</span>
                <span class="token class-name">ServletContextInitializer</span><span class="token punctuation">[</span><span class="token punctuation">]</span> initializers<span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token keyword">super</span><span class="token punctuation">.</span><span class="token function">prepareContext</span><span class="token punctuation">(</span>host<span class="token punctuation">,</span> initializers<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token class-name">StandardContext</span> child <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">StandardContext</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            child<span class="token punctuation">.</span><span class="token function">addLifecycleListener</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">Tomcat</span><span class="token punctuation">.</span><span class="token class-name">FixContextListener</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            child<span class="token punctuation">.</span><span class="token function">setPath</span><span class="token punctuation">(</span><span class="token string">&quot;/cloudfoundryapplication&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token class-name">ServletContainerInitializer</span> initializer <span class="token operator">=</span> <span class="token function">getServletContextInitializer</span><span class="token punctuation">(</span>
                    <span class="token function">getContextPath</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            child<span class="token punctuation">.</span><span class="token function">addServletContainerInitializer</span><span class="token punctuation">(</span>initializer<span class="token punctuation">,</span> <span class="token class-name">Collections</span><span class="token punctuation">.</span><span class="token function">emptySet</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            child<span class="token punctuation">.</span><span class="token function">setCrossContext</span><span class="token punctuation">(</span><span class="token boolean">true</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            host<span class="token punctuation">.</span><span class="token function">addChild</span><span class="token punctuation">(</span>child<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>

    <span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token keyword">private</span> <span class="token class-name">ServletContainerInitializer</span> <span class="token function">getServletContextInitializer</span><span class="token punctuation">(</span><span class="token class-name">String</span> contextPath<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token punctuation">(</span>c<span class="token punctuation">,</span> context<span class="token punctuation">)</span> <span class="token operator">-&gt;</span> <span class="token punctuation">{</span>
        <span class="token class-name">Servlet</span> servlet <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">GenericServlet</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>

            <span class="token annotation punctuation">@Override</span>
            <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">service</span><span class="token punctuation">(</span><span class="token class-name">ServletRequest</span> req<span class="token punctuation">,</span> <span class="token class-name">ServletResponse</span> res<span class="token punctuation">)</span>
                    <span class="token keyword">throws</span> <span class="token class-name">ServletException</span><span class="token punctuation">,</span> <span class="token class-name">IOException</span> <span class="token punctuation">{</span>
                <span class="token class-name">ServletContext</span> context <span class="token operator">=</span> req<span class="token punctuation">.</span><span class="token function">getServletContext</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
                        <span class="token punctuation">.</span><span class="token function">getContext</span><span class="token punctuation">(</span>contextPath<span class="token punctuation">)</span><span class="token punctuation">;</span>
                context<span class="token punctuation">.</span><span class="token function">getRequestDispatcher</span><span class="token punctuation">(</span><span class="token string">&quot;/cloudfoundryapplication&quot;</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">forward</span><span class="token punctuation">(</span>req<span class="token punctuation">,</span>
                        res<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token punctuation">}</span>

        <span class="token punctuation">}</span><span class="token punctuation">;</span>
        context<span class="token punctuation">.</span><span class="token function">addServlet</span><span class="token punctuation">(</span><span class="token string">&quot;cloudfoundry&quot;</span><span class="token punctuation">,</span> servlet<span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">addMapping</span><span class="token punctuation">(</span><span class="token string">&quot;/*&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p><a id="production-ready-whats-next"></a></p>
<h2 id="62&#x3001;&#x4E0B;&#x4E00;&#x6B65;">62&#x3001;&#x4E0B;&#x4E00;&#x6B65;</h2>
<p>&#x5982;&#x679C;&#x4F60;&#x60F3;&#x4E86;&#x89E3;&#x672C;&#x7AE0;&#x4E2D;&#x8BA8;&#x8BBA;&#x7684;&#x4E00;&#x4E9B;&#x6982;&#x5FF5;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x67E5;&#x770B; actuator <a href="https://github.com/spring-projects/spring-boot/tree/v2.1.5.RELEASE/spring-boot-samples" target="_blank">&#x793A;&#x4F8B;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;</a>&#x3002;&#x6216;&#x8BB8;&#x4F60;&#x8FD8;&#x60F3;&#x4E86;&#x89E3; <a href="https://graphite.wikidot.com/" target="_blank">Graphite</a> &#x7B49;&#x56FE;&#x5F62;&#x5DE5;&#x5177;&#x7684;&#x76F8;&#x5173;&#x77E5;&#x8BC6;&#x3002;</p>
<p>&#x6B64;&#x5916;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x7EE7;&#x7EED;&#x9605;&#x8BFB;<a href="deployment.html">&#x5E94;&#x7528;&#x90E8;&#x7F72;</a>&#x76F8;&#x5173;&#x5185;&#x5BB9;&#xFF0C;&#x6216;&#x7EE7;&#x7EED;&#x9605;&#x8BFB;&#x6709;&#x5173; Spring Boot <a href="build-tool-plugins.md">&#x6784;&#x5EFA;&#x5DE5;&#x5177;&#x63D2;&#x4EF6;</a>&#x7684;&#x76F8;&#x5173;&#x5185;&#x5BB9;&#x3002;</p>
<footer class="page-footer"><span class="copyright">powered by Gitbook</span><span class="footer-modification">File Modify: 
2020-01-07 23:30:15
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="spring-boot-features.html#boot-features-whats-next" class="navigation navigation-prev " aria-label="Previous page: 51、下一步">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="production-ready.html#production-ready-enabling" class="navigation navigation-next " aria-label="Next page: 52、启用生产就绪功能">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"五、Spring Boot Actuator: 生产就绪功能","level":"1.7","depth":1,"next":{"title":"52、启用生产就绪功能","level":"1.7.1","depth":2,"anchor":"#production-ready-enabling","path":"pages/production-ready.md","ref":"pages/production-ready.md#production-ready-enabling","articles":[]},"previous":{"title":"51、下一步","level":"1.6.28","depth":2,"anchor":"#boot-features-whats-next","path":"pages/spring-boot-features.md","ref":"pages/spring-boot-features.md#boot-features-whats-next","articles":[]},"dir":"ltr"},"config":{"plugins":["github","splitter","tbfed-pagefooter","-lunr","-search","search-plus","github-buttons","copy-code-button","prism","-highlight","-livereload","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{},"prism":{"css":["prismjs/themes/prism-twilight.css"]},"github":{"url":"https://gitee.com/lichongbing/springboot"},"splitter":{},"fontsettings":{"theme":"white","family":"sans","size":2},"github-buttons":{"repo":"lichongbing/springboot","types":["star","watch"],"size":"small"},"copy-code-button":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"search-plus":{},"image-captions":{"caption":"_CAPTION_"}},"theme":"default","author":"lichongbing.com","pdf":{"pageNumbers":true,"fontSize":16,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":36,"bottom":36}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Spring Boot 中文文档","language":"zh-hans","links":{"sharing":{"all":true,"facebook":true,"google":true,"twitter":true,"qzone":true,"weibo":true}},"gitbook":"*","description":"Spring Boot 中文文档","extension":null},"file":{"path":"pages/production-ready.md","mtime":"2020-01-07T14:30:15.084Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-01-07T14:47:40.777Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github-buttons/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

